Method and apparatus for encoding/decoding a video using a motion compensation

ABSTRACT

The present invention relates to a method for encoding/decoding a video. To this end, the method for decoding a video may include: deriving a spatial merge candidate from at least one of spatial candidate blocks of a current block, deriving a temporal merge candidate from a co-located block of the current block, and generating a prediction block of the current block based on at least one of the derived spatial merge candidate and the derived temporal merge candidate, wherein a reference picture for the temporal merge candidate is selected based on a reference picture list of a current picture including the current block and a reference picture list of a co-located picture including the co-located block.

CROSS REFERENCE TO RELATED APPLICATION(S)

This application is a U.S. National Stage Application of InternationalApplication No. PCT/KR2017/008596, filed on Aug. 9, 2017, which claimsthe benefit under 35 USC 119(a) and 365(b) of Korean Patent ApplicationNo. 10-2016-0102595, filed on Aug. 11, 2016, and Korean PatentApplication No. 10-2016-0158620, filed on Nov. 25, 2016, in the KoreanIntellectual Property Office.

TECHNICAL FIELD

The present invention relates to a method for encoding/decoding a videoand apparatus thereof. More particularly, the present invention relatesto a method and apparatus for performing motion compensation by using amerge mode.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra high definition (UHD) images, haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques arerequired for higher-resolution and higher-quality images.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; a transform and quantization technique for compressing energyof a residual signal; an entropy encoding technique of assigning a shortcode to a value with a high appearance frequency and assigning a longcode to a value with a low appearance frequency; etc. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In motion compensation using a conventional merge mode, only a spatialmerge candidate, a temporal merge candidate, a bi-prediction mergecandidate, and a zero merge candidate are added to a merge candidatelist to be used. Accordingly, only uni-directional prediction andbi-directional prediction are used, and thus there is a limit to enhanceencoding efficiency.

In motion compensation using the conventional merge mode, there is alimit in throughput of the merge mode due to dependency between atemporal merge candidate derivation process and a bi-prediction mergecandidate derivation process. Also, the merge candidate derivationprocesses may not be performed in parallel.

In motion compensation using the conventional merge mode, thebi-prediction merge candidate generated through the bi-prediction mergecandidate derivation process is used as motion information. Thus, memoryaccess bandwidth increases during motion compensation, compared to theuni-prediction merge candidate.

In motion compensation using the conventional merge mode, zero mergecandidate derivation is differently performed according to a slice type,and thus hardware logic is complex. Also, a bi-prediction zero mergecandidate is generated through a bi-prediction zero merge candidatederivation process to be used in motion compensation, and thus memoryaccess bandwidth increases.

DISCLOSURE Technical Problem

An object of the present invention is to provide a method and apparatusfor performing motion compensation by using a combined merge candidateto enhance encoding/decoding efficiency of a video.

Another object of the present invention is to provide a method andapparatus for performing motion compensation by using uni-directionprediction, bi-directional prediction, tri-directional prediction, andquad-directional prediction to enhance encoding/decoding efficiency of avideo.

Another object of the present invention is to provide a method andapparatus for determining motion information through parallelization ofthe merge candidate derivation processes, removal of dependency betweenthe merge candidate derivation processes, bi-prediction merge candidatepartitioning, and uni-prediction zero merge candidate derivation so asto increase throughput of the merge mode and to simplify hardware logic.

Another object of the present invention is to provide a method andapparatus for using a reference picture related to a motion vectorderived from a co-located block as a reference picture for a temporalmerge candidate when deriving the temporal merge candidate from theco-located block in a co-located picture (col picture) corresponding toa current block.

Technical Solution

According to the present invention, a method for decoding a videoincludes: deriving a spatial merge candidate from at least one ofspatial candidate blocks of a current block; deriving a temporal mergecandidate from a co-located block of the current block; and generating aprediction block of the current block based on at least one of thederived spatial merge candidate and the derived temporal mergecandidate, wherein a reference picture for the temporal merge candidateis selected based on a reference picture list of a current pictureincluding the current block and a reference picture list of a co-locatedpicture including the co-located block.

In the method for decoding a video, the reference picture for thetemporal merge candidate may be selected based on whether the referencepicture list of the current picture and the reference picture list ofthe co-located picture are equal to each other.

In the method for decoding a video, when the reference picture list ofthe current picture and the reference picture list of the co-locatedpicture are equal to each other, the reference picture for the temporalmerge candidate may be selected as a reference picture being used by amotion vector derived from the co-located block.

In the method for decoding a video, when at least one reference pictureof the reference picture list of the current picture is same as at leastone reference picture of the reference picture list of the co-locatedpicture, the reference picture for the temporal merge candidate may beselected from the same at least one reference picture.

In the method for decoding a video, the reference picture for thetemporal merge candidate may be selected according to an interprediction direction.

In the method for decoding a video, the spatial merge candidate and thetemporal merge candidate of the current block may be derived for eachsub-block of the current block.

In the method for decoding a video, the temporal merge candidate of thesub-block of the current block may be derived from a sub-block at a sameposition as a sub-block of the current block included in the co-locatedblock.

In the method for decoding a video, when the sub-block at the sameposition is unavailable, the temporal merge candidate of the sub-blockof the current block may be derived from one of a sub-block of a centerposition in the co-located block, a left sub-block of the sub-block atthe same position, and a top sub-block of the sub-block at the sameposition.

In the method for decoding a video, the deriving of the temporal mergecandidate may include: scaling a plurality of motion vectors of theco-located block based on respective reference pictures of a referencepicture list of the current block, and deriving the temporal mergecandidate including the scaled plurality of motion vectors.

In the method for decoding a video, the prediction block of the currentblock may be generated by using a motion vector generated based on aweighted sum of the scaled plurality of motion vectors.

In the method for decoding a video, a plurality of temporary predictionblocks may be generated by respectively using the scaled plurality ofmotion vectors, and the prediction block of the current block may begenerated based on a weighted sum of the generated plurality oftemporary prediction blocks.

In the method for decoding a video, the deriving of the temporal mergecandidate may be performed by scaling motion information of theco-located block based on the reference picture for the temporal mergecandidate.

In the method for decoding a video, the deriving of the temporal mergecandidate by scaling the motion information of the co-located block maybe selectively performed based on a picture order count value betweenthe current picture including the current block and a reference pictureof the current block and a picture order count value between theco-located picture including the co-located block and a referencepicture of the co-located block.

According to the present invention, a method for encoding a videoincludes: deriving a spatial merge candidate from at least one ofspatial candidate blocks of a current block; deriving a temporal mergecandidate from a co-located block of the current block; and generating aprediction block of the current block based on at least one of thederived spatial merge candidate and the derived temporal mergecandidate, wherein a reference picture for the temporal merge candidateis selected based on a reference picture list of a current pictureincluding the current block and a reference picture list of a co-locatedpicture including the co-located block.

According to the present invention, an apparatus for decoding a videoincludes: an inter prediction unit deriving a spatial merge candidatefrom at least one of spatial candidate blocks of a current block,deriving a temporal merge candidate from a co-located block of thecurrent block, and generating a prediction block of the current blockbased on at least one of the derived spatial merge candidate and thederived temporal merge candidate, wherein the inter prediction unitselects a reference picture for the temporal merge candidate based on areference picture list of a current picture including the current blockand a reference picture list of a co-located picture including theco-located block.

According to the present invention, an apparatus for encoding a videoincludes: an inter prediction unit deriving a spatial merge candidatefrom at least one of spatial candidate blocks of a current block,deriving a temporal merge candidate from a co-located block of thecurrent block, and generating a prediction block of the current blockbased on at least one of the derived spatial merge candidate and thederived temporal merge candidate, wherein the inter prediction unitselects a reference picture for the temporal merge candidate based on areference picture list of a current picture including the current blockand a reference picture list of a co-located picture including theco-located block.

According to the present invention, a readable medium storing abitstream formed by a method for encoding a video, the method including:deriving a spatial merge candidate from at least one of spatialcandidate blocks of a current block; deriving a temporal merge candidatefrom a co-located block of the current block; and generating aprediction block of the current block based on at least one of thederived spatial merge candidate and the derived temporal mergecandidate, wherein a reference picture for the temporal merge candidateis selected based on a reference picture list of a current pictureincluding the current block and a reference picture list of a co-locatedpicture including the co-located block.

Advantageous Effects

In the present invention, provided is a method and apparatus forperforming motion compensation by using a combined merge candidate toenhance encoding/decoding efficiency of a video.

In the present invention, provided is a method and apparatus forperforming motion compensation by using uni-directional prediction,bi-directional prediction, tri-directional prediction, andquad-directional prediction to enhance encoding/decoding efficiency of avideo.

In the present invention, provided is a method and apparatus forperforming motion compensation through parallelization of mergecandidate derivation processes, removal of dependency between the mergecandidate derivation processes, bi-prediction merge candidatepartitioning, and uni-prediction zero merge candidate derivation so asto increase throughput of a merge mode and to simplify hardware logic.

In the present invention, provided is a method and apparatus for using areference picture related to a motion vector derived from a co-locatedblock as a reference picture for a temporal merge candidate whenderiving the temporal merge candidate from the co-located block in aco-located picture (col picture) corresponding to a current block.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image.

FIG. 4 is a view showing forms of a prediction unit (PU) that may beincluded in a coding unit (CU).

FIG. 5 is a view showing forms of a transform unit (TU) that may beincluded in a coding unit (CU).

FIG. 6 is a view for explaining an embodiment of a process of intraprediction.

FIG. 7 is a flowchart showing a method for encoding a video by using amerge mode according to the present invention.

FIG. 8 is a flowchart showing a method for decoding a video by using amerge mode according to the present invention.

FIG. 9 is a view showing an example of deriving a temporal mergecandidate and a temporal merge candidate of a current block according tothe present invention.

FIG. 10 is a view showing an example of adding a temporal mergecandidate to a merge candidate list according to the present invention.

FIG. 11 is a view showing an example of scaling a motion vector of aco-located block to derive a temporal merge candidate of a current blockaccording to the present invention.

FIGS. 12 and 13 are views showing examples of a method of adaptivelyselecting a reference picture for a temporal merge candidate and amethod of generating a prediction block by using a temporal mergecandidate according to the present invention.

FIGS. 14 and 15 are views showing examples of a method of adaptivelyselecting a reference picture for a temporal merge candidate in a lowdelay encoding/decoding environment (low delay configuration) accordingto the present invention.

FIGS. 16 and 17 are views showing sub-blocks of a co-located blockaccording to the present invention.

FIG. 18 is a view showing an example of performing motion compensationon each sub-block according to the present invention.

FIG. 19 is a flowchart showing a method for decoding a video accordingto an embodiment of the present invention.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, althoughthe exemplary embodiments can be construed as including allmodifications, equivalents, or substitutes in a technical concept and atechnical scope of the present invention. The similar reference numeralsrefer to the same or similar functions in various aspects. In thedrawings, the shapes and dimensions of elements may be exaggerated forclarity. In the following detailed description of the present invention,references are made to the accompanying drawings that show, by way ofillustration, specific embodiments in which the invention may bepracticed. These embodiments are described in sufficient detail toenable those skilled in the art to implement the present disclosure. Itshould be understood that various embodiments of the present disclosure,although different, are not necessarily mutually exclusive. For example,specific features, structures, and characteristics described herein, inconnection with one embodiment, may be implemented within otherembodiments without departing from the spirit and scope of the presentdisclosure. In addition, it should be understood that the location orarrangement of individual elements within each disclosed embodiment maybe modified without departing from the spirit and scope of the presentdisclosure. The following detailed description is, therefore, not to betaken in a limiting sense, and the scope of the present disclosure isdefined only by the appended claims, appropriately interpreted, alongwith the full range of equivalents to what the claims claim.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded. In other words, when a specific element is referred to as being“included”, elements other than the corresponding element are notexcluded, but additional elements may be included in embodiments of thepresent invention or the scope of the present invention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. In describingexemplary embodiments of the present invention, well-known functions orconstructions will not be described in detail since they mayunnecessarily obscure the understanding of the present invention. Thesame constituent elements in the drawings are denoted by the samereference numerals, and a repeated description of the same elements willbe omitted.

In addition, hereinafter, an image may mean a picture configuring avideo, or may mean the video itself. For example, “encoding or decodingor both of an image” may mean “encoding or decoding or both of a video”,and may mean “encoding or decoding or both of one image among images ofa video.” Here, a picture and the image may have the same meaning.

Term Description

Encoder: may mean an apparatus performing encoding.

Decoder: may mean an apparatus performing decoding.

Parsing: may mean determination of a value of a syntax element byperforming entropy decoding, or may mean the entropy decoding itself.

Block: may mean a sample of an M×N matrix. Here, M and N are positiveintegers, and the block may mean a sample matrix in a two-dimensionalform.

Sample: is a basic unit of a block, and may indicate a value ranging 0to 2 Bd−1 depending on the bit depth (Bd). The sample may mean a pixelin the present invention.

Unit: may mean a unit of encoding and decoding of an image. In encodingand decoding an image, the unit may be an area generated by partitioningone image. In addition, the unit may mean a subdivided unit when oneimage is partitioned into subdivided units during encoding or decoding.In encoding and decoding an image, a predetermined process for each unitmay be performed. One unit may be partitioned into sub units that havesizes smaller than the size of the unit. Depending on functions, theunit may mean a block, a macroblock, a coding tree unit, a coding treeblock, a coding unit, a coding block, a prediction unit, a predictionblock, a transform unit, a transform block, etc. In addition, in orderto distinguish a unit from a block, the unit may include a lumacomponent block, a chroma component block of the luma component block,and a syntax element of each color component block. The unit may havevarious sizes and shapes, and particularly, the shape of the unit may bea two-dimensional geometrical figure such as a rectangular shape, asquare shape, a trapezoid shape, a triangular shape, a pentagonal shape,etc. In addition, unit information may include at least one of a unittype indicating the coding unit, the prediction unit, the transformunit, etc., and a unit size, a unit depth, a sequence of encoding anddecoding of a unit, etc.

Reconstructed Neighbor Unit: may mean a reconstructed unit that ispreviously spatially/temporally encoded or decoded, and thereconstructed unit is adjacent to an encoding/decoding target unit.Here, a reconstructed neighbor unit may mean a reconstructed neighborblock.

Neighbor Block: may mean a block adjacent to an encoding/decoding targetblock. The block adjacent to the encoding/decoding target block may meana block having a boundary being in contact with the encoding/decodingtarget block. The neighbor block may mean a block located at an adjacentvertex of the encoding/decoding target block. The neighbor block maymean a reconstructed neighbor block.

Unit Depth: may mean a partitioned degree of a unit. In a treestructure, a root node may be the highest node, and a leaf node may bethe lowest node.

Symbol: may mean a syntax element of the encoding/decoding target unit,a coding parameter, a value of a transform coefficient, etc.

Parameter Set: may mean header information in a structure of thebitstream. The parameter set may include at least one of a videoparameter set, a sequence parameter set, a picture parameter set, or anadaptation parameter set. In addition, the parameter set may mean sliceheader information and tile header information, etc.

Bitstream: may mean a bit string including encoded image information.

Prediction Unit: may mean a basic unit when performing inter predictionor intra prediction, and compensation for the prediction. One predictionunit may be partitioned into a plurality of partitions. In this case,each of the plurality of partitions may be a basic unit while performingthe predictions and the compensation, and each partition partitionedfrom the prediction unit may be a prediction unit. In addition, oneprediction unit may be partitioned into a plurality of small predictionunits. A prediction unit may have various sizes and shapes, andparticularly, the shape of the prediction unit may be a two-dimensionalgeometrical figure such as a rectangular shape, a square shape, atrapezoid shape, a triangular shape, a pentagonal shape, etc.

Prediction Unit Partition: may mean the shape of a partitionedprediction unit.

Reference Picture List: may mean a list including at least one referencepicture that is used for inter prediction or motion compensation. Typesof the reference picture list may be List Combined (LC), List 0 (L0),List 1 (L1), List 2 (L2), List 3 (L3), etc. At least one referencepicture list may be used for inter prediction.

Inter-Prediction Indicator: may mean one of the inter-predictiondirection (one-way directional prediction, bidirectional prediction,etc.) of an encoding/decoding target block in a case of interprediction, the number of reference pictures used for generating aprediction block by the encoding/decoding target block, and the numberof reference blocks used for performing inter prediction or motioncompensation by the encoding/decoding target block.

Reference Picture Index: may mean an index of a specific referencepicture in the reference picture list.

Reference Picture: may mean a picture to which a specific unit refersfor inter prediction or motion compensation. A reference image may bereferred to as the reference picture.

Motion Vector: is a two-dimensional vector used for inter prediction ormotion compensation, and may mean an offset between an encoding/decodingtarget picture and the reference picture. For example, (mvX, mvY) mayindicate the motion vector, mvX may indicate a horizontal component, andmvY may indicate a vertical component.

Motion Vector Candidate: may mean a unit that becomes a predictioncandidate when predicting the motion vector, or may mean a motion vectorof the unit.

Motion Vector Candidate List: may mean a list configured by using themotion vector candidate.

Motion Vector Candidate Index: may mean an indicator that indicates themotion vector candidate in the motion vector candidate list. The motionvector candidate index may be referred to as an index of a motion vectorpredictor.

Motion Information: may mean the motion vector, the reference pictureindex, and inter-prediction indicator as well as information includingat least one of reference picture list information, the referencepicture, the motion vector candidate, the motion vector candidate index,etc.

Merge Candidate List: may mean a list configured by using the mergecandidate.

Merge Candidate: may include a spatial merge candidate, a temporal mergecandidate, a combined merge candidate, a combined bi-prediction mergecandidate, a zero merge candidate, etc. The merge candidate may includemotion information such as prediction type information, a referencepicture index for each list, a motion vector, etc.

Merge Index: may mean information indicating the merge candidate in themerge candidate list. In addition, the merge index may indicate a block,which derives the merge candidate, among reconstructed blocksspatially/temporally adjacent to the current block. In addition, themerge index may indicate at least one of pieces of motion information ofthe merge candidate.

Transform Unit: may mean a basic unit when performing encoding/decodingof a residual signal, similar to transform, inverse transform,quantization, dequantization, and transform coefficientencoding/decoding. One transform unit may be partitioned into aplurality of small transform units. The transform unit may have varioussizes and shapes. Particularly, the shape of the transform unit may be atwo-dimensional geometrical figure such as a rectangular shape, a squareshape, a trapezoid shape, a triangular shape, a pentagonal shape, etc.

Scaling: may mean a process of multiplying a factor to a transformcoefficient level, and as a result, a transform coefficient may begenerated. The scaling may be also referred to as dequantization.

Quantization Parameter: may mean a value used in scaling the transformcoefficient level during quantization and dequantization. Here, thequantization parameter may be a value mapped to a step size of thequantization.

Delta Quantization Parameter: may mean a difference value between apredicted quantization parameter and a quantization parameter of theencoding/decoding target unit.

Scan: may mean a method of sorting coefficient orders within a block ora matrix. For example, sorting a two-dimensional matrix into aone-dimensional matrix may be referred to as scanning, and sorting aone-dimensional matrix into a two-dimensional matrix may be referred toas scanning or inverse scanning.

Transform Coefficient: may mean a coefficient value generated afterperforming a transform. In the present invention, a quantized transformcoefficient level that is a transform coefficient to which thequantization is applied may be referred to as the transform coefficient.

Non-zero Transform Coefficient: may mean a transform coefficient inwhich a value thereof is not 0, or may mean a transform coefficientlevel in which a value thereof is not 0.

Quantization Matrix: may mean a matrix used in quantization anddequantization in order to enhance subject quality or object quality ofan image. The quantization matrix may be referred to as a scaling list.

Quantization Matrix Coefficient: may mean each element of a quantizationmatrix. The quantization matrix coefficient may be referred to as amatrix coefficient.

Default Matrix: may mean a predetermined quantization matrix that isdefined in the encoder and the decoder in advance.

Non-default Matrix: may mean a quantization matrix that istransmitted/received by a user without being previously defined in theencoder and the decoder.

Coding Tree Unit: may be composed of one luma component (Y) coding treeunit and related two chroma components (Cb, Cr) coding tree units. Eachcoding tree unit may be partitioned by using at least one partitionmethod such as a quad tree, a binary tree, etc. to configure sub unitssuch as coding units, prediction units, transform units, etc. The codingtree unit may be used as a term for indicating a pixel block that is aprocessing unit in decoding/encoding process of an image, like partitionof an input image.

Coding Tree Block: may be used as a term for indicating one of the Ycoding tree unit, the Cb coding tree unit, and the Cr coding tree unit.

FIG. 1 is a block diagram showing configurations of an encodingapparatus according to an embodiment of the present invention.

The encoding apparatus 100 may be a video encoding apparatus or an imageencoding apparatus. A video may include one or more images. The encodingapparatus 100 may encode the one or more images of the video in order oftime.

Referring to FIG. 1, the encoding apparatus 100 may include a motionprediction unit 111, a motion compensation unit 112, an intra-predictionunit 120, a switch 115, a subtractor 125, a transform unit 130, aquantization unit 140, an entropy encoding unit 150, a dequantizationunit 160, an inverse transform unit 170, an adder 175, a filter unit180, and a reference picture buffer 190.

The encoding apparatus 100 may encode an input picture in an intra modeor an inter mode or both. In addition, the encoding apparatus 100 maygenerate a bitstream by encoding the input picture, and may output thegenerated bitstream. When the intra mode is used as a prediction mode,the switch 115 may be switched to intra. When the inter mode is used asa prediction mode, the switch 115 may be switched to inter. Here, theintra mode may be referred to as an intra-prediction mode, and the intermode may be referred to as an inter-prediction mode. The encodingapparatus 100 may generate a prediction block of an input block of theinput picture. In addition, after generating the prediction block, theencoding apparatus 100 may encode residuals between the input block andthe prediction block. The input picture may be referred to as a currentimage that is a target of current encoding. The input block may bereferred to as a current block or as an encoding target block that is atarget of the current encoding.

When the prediction mode is the intra mode, the intra-prediction unit120 may use a pixel value of a previously encoded block, which isadjacent to the current block, as a reference pixel. Theintra-prediction unit 120 may perform spatial prediction by using thereference pixel, and may generate prediction samples of the input blockby using the spatial prediction. Here, intra prediction may meanintra-frame prediction.

When the prediction mode is the inter mode, the motion prediction unit111 may search for a region that is optimally matched with the inputblock from a reference picture in a motion predicting process, and mayderive a motion vector by using the searched region. The referencepicture may be stored in the reference picture buffer 190.

The motion compensation unit 112 may generate the prediction block byperforming motion compensation using the motion vector. Here, the motionvector may be a two-dimensional vector that is used for interprediction. In addition, the motion vector may indicate offset betweenthe current picture and the reference picture. Here, inter predictionmay be mean inter-frame prediction.

When a value of the motion vector is not an integer, the motionprediction unit 111 and the motion compensation unit 112 may generatethe prediction block by applying an interpolation filter to a partialregion in the reference picture. In order to perform inter prediction ormotion compensation, on the basis of the coding unit, it is possible todetermine which methods the motion prediction and compensation methodsof a prediction unit in the coding unit uses among the skip mode, themerge mode, the AMVP mode, and a current picture reference mode. Interprediction or motion compensation may be performed according to eachmode. Here, the current picture reference mode may mean a predictionmode using a pre-reconstructed region of a current picture having anencoding target block. In order to specify the pre-reconstructed region,a motion vector for the current picture reference mode may be defined.Whether the encoding target block is encoded in the current picturereference mode may be encoded by using a reference picture index of theencoding target block.

The subtractor 125 may generate a residual block by using the residualsbetween the input block and the prediction block. The residual block maybe referred to as a residual signal.

The transform unit 130 may generate a transform coefficient bytransforming the residual block, and may output the transformcoefficient. Here, the transform coefficient may be a coefficient valuegenerated by transforming the residual block. In a transform skip mode,the transform unit 130 may skip the transforming of the residual block.

A quantized transform coefficient level may be generated by applyingquantization to the transform coefficient. Hereinafter, the quantizedtransform coefficient level may be referred to as the transformcoefficient in the embodiment of the present invention.

The quantization unit 140 may generate the quantized transformcoefficient level by quantizing the transform coefficient depending onthe quantization parameter, and may output the quantized transformcoefficient level. Here, the quantization unit 140 may quantize thetransform coefficient by using a quantization matrix.

The entropy encoding unit 150 may generate the bitstream by performingentropy encoding according to the probability distribution, on valuescalculated by the quantization unit 140 or on coding parameter valuescalculated in an encoding process, etc., and may output the generatedbitstream. The entropy encoding unit 150 may perform the entropyencoding on information for decoding an image, and on information of apixel of an image. For example, the information for decoding an imagemay include a syntax element, etc.

When the entropy encoding is applied, symbols are represented byallocating a small number of bits to the symbols having high occurrenceprobability and allocating a large number of bits to the symbols havinglow occurrence probability, thereby reducing the size of the bitstreamof encoding target symbols. Therefore, compression performance of theimage encoding may be increased through the entropy encoding. For theentropy encoding, the entropy encoding unit 150 may use an encodingmethod such as exponential Golomb, context-adaptive variable lengthcoding (CAVLC), and context-adaptive binary arithmetic coding (CABAC).For example, the entropy encoding unit 150 may perform the entropyencoding by using a variable length coding/code (VLC) table. Inaddition, the entropy encoding unit 150 may derive a binarization methodof the target symbol and a probability model of the target symbol/bin,and may perform arithmetic coding by using the derived binarizationmethod or the derived probability model thereafter.

In order to encode the transform coefficient level, the entropy encodingunit 150 may change a two-dimensional block form coefficient into aone-dimensional vector form by using a transform coefficient scanningmethod. For example, the two-dimensional form coefficient may be changedinto the one-dimensional vector form by scanning the coefficient of theblock with up-right scanning. According to the size of the transformunit and the intra-prediction mode, instead of the up-right scanning, itis possible to use vertical direction scanning for scanning thetwo-dimensional block form coefficient in a column direction, andhorizontal direction scanning for scanning the two-dimensional blockform coefficient in a row direction. That is, it is possible todetermine which scanning method among up-right scanning, verticaldirection scanning, and horizontal direction scanning is to be useddepending on the size of the transform unit and the intra-predictionmode.

The coding parameter may include information, such as the syntaxelement, which is encoded by the encoder and is transmitted to thedecoder, and may include information that may be derived in the encodingor decoding process. The coding parameter may mean information that isnecessary to encode or decode an image. For example, the codingparameter may include at least one value or combined form of the blocksize, the block depth, the block partition information, the unit size,the unit depth, the unit partition information, the partition flag of aquad-tree form, the partition flag of a binary-tree form, the partitiondirection of a binary-tree form, the intra-prediction mode, theintra-prediction direction, the reference sample filtering method, theprediction block boundary filtering method, the filter tap, the filtercoefficient, the inter-prediction mode, the motion information, themotion vector, the reference picture index, the inter-predictiondirection, the inter-prediction indicator, the reference picture list,the motion vector predictor, the motion vector candidate list, theinformation about whether or not the motion merge mode is used, themotion merge candidate, motion merge candidate list, the informationabout whether or not the skip mode is used, interpolation filter type,the motion vector size, accuracy of motion vector representation, thetransform type, the transform size, the information about whetheradditional (secondary) transform is used, the information about whetheror not a residual signal is present, the coded block pattern, the codedblock flag, the quantization parameter, the quantization matrix, thefilter information within a loop, the information about whether or not afilter is applied within a loop, the filter coefficient within a loop,binarization/inverse binarization method, the context model, the contextbin, the bypass bin, the transform coefficient, transform coefficientlevel, transform coefficient level scanning method, the imagedisplay/output order, slice identification information, slice type,slice partition information, tile identification information, tile type,tile partition information, the picture type, bit depth, and theinformation of a luma signal or a chroma signal.

The residual signal may mean the difference between the original signaland the prediction signal. Alternatively, the residual signal may be asignal generated by transforming the difference between the originalsignal and the prediction signal. Alternatively, the residual signal maybe a signal generated by transforming and quantizing the differencebetween the original signal and the prediction signal. The residualblock may be the residual signal of a block unit.

When the encoding apparatus 100 performs encoding by using interprediction, the encoded current picture may be used as a referencepicture for another image(s) that will be processed thereafter.Accordingly, the encoding apparatus 100 may decode the encoded currentpicture, and may store the decoded image as the reference picture. Inorder to perform the decoding, dequantization and inverse transform maybe performed on the encoded current picture.

A quantized coefficient may be dequantized by the dequantization unit160, and may be inversely transformed by the inverse transform unit 170.The dequantized and inversely transformed coefficient may be added tothe prediction block by the adder 175, whereby a reconstructed block maybe generated.

The reconstructed block may pass the filter unit 180. The filter unit180 may apply at least one of a deblocking filter, a sample adaptiveoffset (SAO), and an adaptive loop filter (ALF) to the reconstructedblock or a reconstructed picture. The filter unit 180 may be referred toas an in-loop filter.

The deblocking filter may remove block distortion that occurs atboundaries between the blocks. In order to determine whether or not thedeblocking filter is operated, it is possible to determine whether ornot the deblocking filter is applied to the current block on the basisof the pixels included in several rows or columns in the block. When thedeblocking filter is applied to the block, a strong filter or a weakfilter may be applied depending on required deblocking filteringstrength. In addition, in applying the deblocking filter, horizontaldirection filtering and vertical direction filtering may be processed inparallel.

The sample adaptive offset may add an optimum offset value to the pixelvalue in order to compensate for an encoding error. The sample adaptiveoffset may correct an offset between the deblocking filtered image andthe original picture for each pixel. In order to perform the offsetcorrection on a specific picture, it is possible to use a method ofapplying an offset in consideration of edge information of each pixel ora method of partitioning pixels of an image into the predeterminednumber of regions, determining a region to be subjected to perform anoffset correction, and applying the offset correction to the determinedregion.

The adaptive loop filter may perform filtering on the basis of a valueobtained by comparing the reconstructed picture and the originalpicture. Pixels of an image may be partitioned into predeterminedgroups, one filter being applied to each of the groups is determined,and different filtering may be performed at each of the groups.Information about whether or not the adaptive loop filter is applied tothe luma signal may be transmitted for each coding unit (CU). A shapeand a filter coefficient of an adaptive loop filter being applied toeach block may vary. In addition, an adaptive loop filter having thesame form (fixed form) may be applied regardless of characteristics of atarget block.

The reconstructed block that passed the filter unit 180 may be stored inthe reference picture buffer 190.

FIG. 2 is a block diagram showing configurations of a decoding apparatusaccording to an embodiment of the present invention.

The decoding apparatus 200 may be a video decoding apparatus or an imagedecoding apparatus.

Referring to FIG. 2, the decoding apparatus 200 may include an entropydecoding unit 210, a dequantization unit 220, an inverse transform unit230, an intra-prediction unit 240, a motion compensation unit 250, anadder 255, a filter unit 260, and a reference picture buffer 270.

The decoding apparatus 200 may receive the bitstream outputted from theencoding apparatus 100. The decoding apparatus 200 may decode thebitstream in the intra mode or the inter mode. In addition, the decodingapparatus 200 may generate a reconstructed picture by performingdecoding, and may output the reconstructed picture.

When a prediction mode used in decoding is the intra mode, the switchmay be switched to intra. When the prediction mode used in decoding isthe inter mode, the switch may be switched to inter.

The decoding apparatus 200 may obtain the reconstructed residual blockfrom the inputted bitstream, and may generate the prediction block. Whenthe reconstructed residual block and the prediction block are obtained,the decoding apparatus 200 may generate the reconstructed block, whichis a decoding target block, by adding the reconstructed residual blockand the prediction block. The decoding target block may be referred toas a current block.

The entropy decoding unit 210 may generate symbols by performing entropydecoding on the bitstream according to the probability distribution. Thegenerated symbols may include a symbol having a quantized transformcoefficient level. Here, a method of entropy decoding may be similar tothe above-described method of the entropy encoding. For example, themethod of the entropy decoding may be an inverse process of theabove-described method of the entropy encoding.

In order to decode the transform coefficient level, the entropy decodingunit 210 may perform transform coefficient scanning, whereby theone-dimensional vector form coefficient can be changed into thetwo-dimensional block form. For example, the one-dimensional vector formcoefficient may be changed into a two-dimensional block form by scanningthe coefficient of the block with up-right scanning. According to thesize of the transform unit and the intra-prediction mode, instead ofup-right scanning, it is possible to use vertical direction scanning andhorizontal direction scanning. That is, it is possible to determinewhich scanning method among up-right scanning, vertical directionscanning, and horizontal direction scanning is used depending on thesize of the transform unit and the intra-prediction mode.

The quantized transform coefficient level may be dequantized by thedequantization unit 220, and may be inversely transformed by the inversetransform unit 230. The quantized transform coefficient level isdequantized and is inversely transformed so as to generate areconstructed residual block. Here, the dequantization unit 220 mayapply the quantization matrix to the quantized transform coefficientlevel.

When the intra mode is used, the intra-prediction unit 240 may generatea prediction block by performing the spatial prediction that uses thepixel value of the previously decoded block that is adjacent to thedecoding target block.

When the inter mode is used, the motion compensation unit 250 maygenerate the prediction block by performing motion compensation thatuses both the motion vector and the reference picture stored in thereference picture buffer 270. When the value of the motion vector is notan integer, the motion compensation unit 250 may generate the predictionblock by applying the interpolation filter to the partial region in thereference picture. In order to perform motion compensation, on the basisof the coding unit, it is possible to determine which method the motioncompensation method of a prediction unit in the coding unit uses amongthe skip mode, the merge mode, the AMVP mode, and a current picturereference mode. In addition, it is possible to perform motioncompensation depending on the modes. Here, the current picture referencemode may mean a prediction mode using a previously reconstructed regionwithin the current picture having the decoding target block. Thepreviously reconstructed region may not be adjacent to the decodingtarget block. In order to specify the previously reconstructed region, afixed vector may be used for the current picture reference mode. Inaddition, a flag or an index indicating whether or not the decodingtarget block is a block decoded in the current picture reference modemay be signaled, and may be derived by using the reference picture indexof the decoding target block. The current picture for the currentpicture reference mode may exist at a fixed position (for example, aposition of a reference picture index is 0 or the last position) withinthe reference picture list for the decoding target block. In addition,it is possible for the current picture to be variably positioned withinthe reference picture list, and to this end, it is possible to signalthe reference picture index indicating a position of the currentpicture. Here, signaling a flag or an index may mean that the encoderentropy encodes the corresponding flag or index and includes into abitstream, and that the decoder entropy decodes the corresponding flagor index from the bitstream.

The reconstructed residual block may be added to the prediction block bythe adder 255. A block generated by adding the reconstructed residualblock and the prediction block may pass the filter unit 260. The filterunit 260 may apply at least one of the deblocking filter, the sampleadaptive offset, and the adaptive loop filter to the reconstructed blockor to the reconstructed picture. The filter unit 260 may output thereconstructed picture. The reconstructed picture may be stored in thereference picture buffer 270, and may be used for inter prediction.

FIG. 3 is a view schematically showing a partition structure of an imagewhen encoding and decoding the image. FIG. 3 schematically shows anembodiment of partitioning one unit into a plurality of sub-units.

In order to efficiently partition an image, a coding unit (CU) may beused in encoding and decoding. Here, the coding unit may mean anencoding unit. The unit may be a combination of 1) a syntax element and2) a block including image samples. For example, “partition of a unit”may mean “partition of a block relative to a unit”. The block partitioninformation may include information about the unit depth. Depthinformation may indicate the number of times a unit is partitioned or apartitioned degree of a unit or both.

Referring to FIG. 3, an image 300 is sequentially partitioned for eachlargest coding unit (LCU), and a partition structure is determined foreach LCU. Here, the LCU and a coding tree unit (CTU) have the samemeaning. One unit may have depth information based on a tree structure,and may be hierarchically partitioned. Each of the partitioned sub-unitsmay have depth information. The depth information indicates the numberof times a unit is partitioned or a partitioned degree of a unit orboth, and thus, the depth information may include information about thesize of the sub-unit.

The partition structure may mean distribution of a coding unit (CU) inthe LCU 310. The CU may be a unit for efficiently encoding/decoding animage. The distribution may be determined on the basis of whether or notone CU will be partitioned in plural (a positive integer equal to ormore than 2 including 2, 4, 8, 16, etc.). The width size and the heightsize of the partitioned CU may respectively be a half width size and ahalf height size of the original CU. Alternatively, according to thenumber of partitionings, the width size and the height size of thepartitioned CU may respectively be smaller than the width size and theheight size of the original CU. The partitioned CU may be recursivelypartitioned into a plurality of further partitioned CUs, wherein thefurther partitioned CU has a width size and a height size smaller thanthose of the partitioned CU in the same partition method.

Here, the partition of a CU may be recursively performed up to apredetermined depth. Depth information may be information indicating asize of the CU, and may be stored in each CU. For example, the depth ofthe LCU may be 0, and the depth of a smallest coding unit (SCU) may be apredetermined maximum depth. Here, the LCU may be a coding unit having amaximum size as described above, and the SCU may be a coding unit havinga minimum size.

Whenever the LCU 310 begins to be partitioned, and the width size andthe height size of the CU are decreased by the partitioning, the depthof a CU is increased by 1. In a case of a CU which cannot bepartitioned, the CU may have a 2N×2N size for each depth. In a case of aCU that can be partitioned, the CU having a 2N×2N size may bepartitioned into a plurality of N×N-size CUs. The size of N is reducedby half whenever the depth is increased by 1.

For example, when one coding unit is partitioned into four sub-codingunits, a width size and a height size of one of the four sub-codingunits may respectively be a half width size and a half height size ofthe original coding unit. For example, when a 32×32-size coding unit ispartitioned into four sub-coding units, each of the four sub-codingunits may have a 16×16 size. When one coding unit is partitioned intofour sub-coding units, the coding unit may be partitioned in a quad-treeform.

For example, when one coding unit is partitioned into two sub-codingunits, a width size or a height size of one of the two sub-coding unitsmay respectively be a half width size or a half height size of theoriginal coding unit. For example, when a 32×32-size coding unit isvertically partitioned into two sub-coding units, each of the twosub-coding units may have a 16×32 size. For example, when a 32×32-sizecoding unit is horizontally partitioned into two sub-coding units, eachof the two sub-coding units may have a 32×16 size. When one coding unitis partitioned into two sub-coding units, the coding unit may bepartitioned in a binary-tree form.

Referring to FIG. 3, the size of the LCU having a minimum depth of 0 maybe 64×64 pixels, and the size of the SCU having a maximum depth of 3 maybe 8×8 pixels. Here, a CU having 64×64 pixels, which is the LCU, may bedenoted by a depth of 0, a CU having 32×32 pixels may be denoted by adepth of 1, a CU having 16×16 pixels may be denoted by a depth of 2, anda CU having 8×8 pixels, which is the SCU, may be denoted by a depth of3.

In addition, information about whether or not a CU will be partitionedmay be represented through partition information of a CU. The partitioninformation may be 1 bit information. The partition information may beincluded in all CUs other than the SCU. For example, when a value of thepartition information is 0, a CU may not be partitioned, and when avalue of the partition information is 1, a CU may be partitioned.

FIG. 4 is a view showing forms of a prediction unit (PU) that may beincluded in a coding unit (CU).

A CU that is no longer partitioned, from among CUs partitioned from theLCU, may be partitioned into at least one prediction unit (PU). Thisprocess may be also referred to as a partition.

The PU may be a basic unit for prediction. The PU may be encoded anddecoded in any one of a skip mode, an inter mode, and an intra mode. ThePU may be partitioned in various forms depending on the modes.

In addition, the coding unit may not be partitioned into a plurality ofprediction units, and the coding unit and the prediction unit have thesame size.

As shown in FIG. 4, in the skip mode, the CU may not be partitioned. Inthe skip mode, a 2N×2N mode 410 having the same size as a CU withoutpartition may be supported.

In the inter mode, 8 partitioned forms may be supported within a CU. Forexample, in the inter mode, the 2N×2N mode 410, a 2N×N mode 415, an N×2Nmode 420, an N×N mode 425, a 2N×nU mode 430, a 2N×nD mode 435, an nL×2Nmode 440, and an nR×2N mode 445 may be supported. In the intra mode, the2N×2N mode 410 and the N×N mode 425 may be supported.

One coding unit may be partitioned into one or more prediction units.One prediction unit may be partitioned into one or more sub-predictionunits.

For example, when one prediction unit is partitioned into foursub-prediction units, a width size and a height size of one of the foursub-prediction units may be a half width size and a half height size ofthe original prediction unit. For example, when a 32×32-size predictionunit is partitioned into four sub-prediction units, each of the foursub-prediction units may have a 16×16 size. When one prediction unit ispartitioned into four sub-prediction units, the prediction unit may bepartitioned in the quad-tree form.

For example, when one prediction unit is partitioned into twosub-prediction units, a width size or a height size of one of the twosub-prediction units may be a half width size or a half height size ofthe original prediction unit. For example, when a 32×32-size predictionunit is vertically partitioned into two sub-prediction units, each ofthe two sub-prediction units may have a 16×32 size. For example, when a32×32-size prediction unit is horizontally partitioned into twosub-prediction units, each of the two sub-prediction units may have a32×16 size. When one prediction unit is partitioned into twosub-prediction units, the prediction unit may be partitioned in thebinary-tree form.

FIG. 5 is a view showing forms of a transform unit (TU) that may beincluded in a coding unit (CU).

A transform unit (TU) may be a basic unit used for a transform,quantization, a reverse transform, and dequantization within a CU. TheTU may have a square shape or a rectangular shape, etc. The TU may bedependently determined by a size of a CU or a form of a CU or both.

A CU that is no longer partitioned among CUs partitioned from the LCUmay be partitioned into at least one TU. Here, the partition structureof the TU may be a quad-tree structure. For example, as shown in FIG. 5,one CU 510 may be partitioned once or more depending on the quad-treestructure. The case where one CU is partitioned at least once may bereferred to as recursive partition. Through the partitioning, one CU 510may be formed of TUs having various sizes. Alternatively, a CU may bepartitioned into at least one TU depending on the number of verticallines partitioning the CU or the number of horizontal lines partitioningthe CU or both. The CU may be partitioned into TUs that are symmetricalto each other, or may be partitioned into TUs that are asymmetrical toeach other. In order to partition the CU into TUs that are symmetricalto each other, information of a size/shape of the TU may be signaled,and may be derived from information of a size/shape of the CU.

In addition, the coding unit may not be partitioned into transformunits, and the coding unit and the transform unit may have the samesize.

One coding unit may be partitioned into at least one transform unit, andone transform unit may be partitioned into at least one sub-transformunit.

For example, when one transform unit is partitioned into foursub-transform units, a width size and a height size of one of the foursub-transform units may respectively be a half width size and a halfheight size of the original transform unit. For example, when a32×32-size transform unit is partitioned into four sub-transform units,each of the four sub-transform units may have a 16×16 size. When onetransform unit is partitioned into four sub-transform units, thetransform unit may be partitioned in the quad-tree form.

For example, when one transform unit is partitioned into twosub-transform units, a width size or a height size of one of the twosub-transform units may respectively be a half width size or a halfheight size of the original transform unit. For example, when a32×32-size transform unit is vertically partitioned into twosub-transform units, each of the two sub-transform units may have a16×32 size. For example, when a 32×32-size transform unit ishorizontally partitioned into two sub-transform units, each of the twosub-transform units may have a 32×16 size. When one transform unit ispartitioned into two sub-transform units, the transform unit may bepartitioned in the binary-tree form.

When performing transform, the residual block may be transformed byusing at least one of predetermined transform methods. For example, thepredetermined transform methods may include discrete cosine transform(DCT), discrete sine transform (DST), KLT, etc. Which transform methodis applied to transform the residual block may be determined by using atleast one of inter-prediction mode information of the prediction unit,intra-prediction mode information of the prediction unit, and size/shapeof the transform block. Information indicating the transform method maybe signaled.

FIG. 6 is a view for explaining an embodiment of a process of intraprediction.

The intra-prediction mode may be a non-directional mode or a directionalmode. The non-directional mode may be a DC mode or a planar mode. Thedirectional mode may be a prediction mode having a particular directionor angle, and the number of directional modes may be M which is equal toor greater than one. The directional mode may be indicated as at leastone of a mode number, a mode value, and a mode angle.

The number of intra-prediction modes may be N which is equal to orgreater than one, including the non-directional and directional modes.

The number of intra-prediction modes may vary depending on the size of ablock. For example, when the size is 4×4 or 8×8, the number may be 67,and when the size is 16×16, the number may be 35, and when the size is32×32, the number may be 19, and when the size is 64×64, the number maybe 7.

The number of intra-prediction modes may be fixed to N regardless of thesize of a block. For example, the number may be fixed to at least one of35 or 67 regardless of the size of a block.

The number of intra-prediction modes may vary depending on a type of acolor component. For example, the number of prediction modes may varydepending on whether a color component is a luma signal or a chromasignal.

Intra encoding and/or decoding may be performed by using a sample valueor an encoding parameter included in a reconstructed neighboring block.

For encoding/decoding a current block in intra prediction, whether ornot samples included in a reconstructed neighboring block are availableas reference samples of an encoding/decoding target block may beidentified. When there are samples that cannot be used as referencesamples of the encoding/decoding target block, sample values are copiedand/or interpolated into the samples that cannot be used as thereference samples by using at least one of samples included in thereconstructed neighboring block, whereby the samples that cannot be usedas reference samples can be used as the reference samples of theencoding/decoding target block.

In intra prediction, based on at least one of an intra-prediction modeand the size of the encoding/decoding target block, a filter may beapplied to at least one of a reference sample or a prediction sample.Here, the encoding/decoding target block may mean a current block, andmay mean at least one of a coding block, a prediction block, and atransform block. A type of a filter being applied to a reference sampleor a prediction sample may vary depending on at least one of theintra-prediction mode or size/shape of the current block. The type ofthe filter may vary depending on at least one of the number of filtertaps, a filter coefficient value, or filter strength.

In a non-directional planar mode among intra-prediction modes, whengenerating a prediction block of the encoding/decoding target block, asample value in the prediction block may be generated by using aweighted sum of an upper reference sample of the current sample, a leftreference sample of the current sample, an upper right reference sampleof the current block, and a lower left reference sample of the currentblock according to the sample location.

In a non-directional DC mode among intra-prediction modes, whengenerating a prediction block of the encoding/decoding target block, itmay be generated by an average value of upper reference samples of thecurrent block and left reference samples of the current block. Inaddition, filtering may be performed on one or more upper rows and oneor more left columns adjacent to the reference sample in theencoding/decoding block by using reference sample values.

In a case of multiple directional modes (angular mode) amongintra-prediction modes, a prediction block may be generated by using theupper right and/or lower left reference sample, and the directionalmodes may have different direction. In order to generate a predictionsample value, interpolation of a real number unit may be performed.

In order to perform an intra-prediction method, an intra-prediction modeof a current prediction block may be predicted from an intra-predictionmode of a neighboring prediction block that is adjacent to the currentprediction block. In a case of prediction the intra-prediction mode ofthe current prediction block by using mode information predicted fromthe neighboring intra-prediction mode, when the current prediction blockand the neighboring prediction block have the same intra-predictionmode, information that the current prediction block and the neighboringprediction block have the same intra-prediction mode may be transmittedby using predetermined flag information. When the intra-prediction modeof the current prediction block is different from the intra-predictionmode of the neighboring prediction block, intra-prediction modeinformation of the encoding/decoding target block may be encoded byperforming entropy encoding.

explaining an embodiment of a process of inter prediction.

The quadrangular shapes may indicate images (or, pictures). Also, thearrows may indicate prediction directions. That is, images may beencoded or decoded or both according to prediction directions. Eachimage may be classified into an I-picture (intra picture), a P-picture(uni-predictive picture), a B-picture (bi-predictive picture), etc.according to encoding types. Each picture may be encoded and decodeddepending on an encoding type of each picture.

When an image, which is an encoding target, is an I-picture, the imageitself may be intra encoded without inter prediction. When an image,which is an encoding target, is a P-picture, the image may be encoded byinter prediction or motion compensation using a reference picture onlyin a forward direction. When an image, which is an encoding target, is aB-picture, the image may be encoded by inter prediction or motioncompensation using reference pictures in both a forward direction and areverse direction. Alternatively, the image may be encoded by interprediction or motion compensation using a reference picture in one of aforward direction and a reverse direction. Here, when aninter-prediction mode is used, the encoder may perform inter predictionor motion compensation, and the decoder may perform motion compensationin response to the encoder. Images of the P-picture and the B-picturethat are encoded or decoded or both by using a reference picture may beregarded as an image for inter prediction.

Hereinafter, inter prediction according to an embodiment will bedescribed in detail.

Inter prediction or motion compensation may be performed by using both areference picture and motion information. In addition, inter predictionmay use the above described skip mode.

The reference picture may be at least one of a previous picture and asubsequent picture of a current picture. Here, inter prediction maypredict a block of the current picture depending on the referencepicture. Here, the reference picture may mean an image used inpredicting a block. Here, an area within the reference picture may bespecified by using a reference picture index (refIdx) indicating areference picture, a motion vector, etc.

Inter prediction may select a reference picture and a reference blockrelative to a current block within the reference picture. A predictionblock of the current block may be generated by using the selectedreference block. The current block may be a block that is a currentencoding or decoding target among blocks of the current picture.

Motion information may be derived from a process of inter prediction bythe encoding apparatus 100 and the decoding apparatus 200. In addition,the derived motion information may be used in performing interprediction. Here, the encoding apparatus 100 and the decoding apparatus200 may enhance encoding efficiency or decoding efficiency or both byusing motion information of a reconstructed neighboring block or motioninformation of a collocated block (col block) or both. The col block maybe a block relative to a spatial position of the encoding/decodingtarget block within a collocated picture (col picture) that ispreviously reconstructed. The reconstructed neighboring block may be ablock within a current picture, and a block that is previouslyreconstructed through encoding or decoding or both. In addition, thereconstructed block may be a block adjacent to the encoding/decodingtarget block or a block positioned at an outer corner of theencoding/decoding target block or both. Here, the block positioned atthe outer corner of the encoding/decoding target block may be a blockthat is vertically adjacent to a neighboring block horizontally adjacentto the encoding/decoding target block. Alternatively, the blockpositioned at the outer corner of the encoding/decoding target block maybe a block that is horizontally adjacent to a neighboring blockvertically adjacent to the encoding/decoding target block.

The encoding apparatus 100 and the decoding apparatus 200 mayrespectively determine a block that exists at a position spatiallyrelative to the encoding/decoding target block within the col picture,and may determine a predefined relative position on the basis of thedetermined block. The predefined relative position may be an innerposition or an outer position or both of a block that exists at aposition spatially relative to the encoding/decoding target block. Inaddition, the encoding apparatus 100 and the decoding apparatus 200 mayrespectively derive the col block on the basis of the determinedpredefined relative position. Here, the col picture may be one pictureof at least one reference picture included in the reference picturelist.

A method of deriving the motion information may vary according to aprediction mode of the encoding/decoding target block. For example, aprediction mode being applied for inter prediction may include anadvanced motion vector prediction (AMVP), a merge mode, etc. Here, themerge mode may be referred to as a motion merge mode.

For example, when AMVP is applied as the prediction mode, the encodingapparatus 100 and the decoding apparatus 200 may respectively generate amotion vector candidate list by using a motion vector of thereconstructed neighboring block or a motion vector of the col block orboth. The motion vector of the reconstructed neighboring block or themotion vector of the col block or both may be used as motion vectorcandidates. Here, the motion vector of the col block may be referred toas a temporal motion vector candidate, and the motion vector of thereconstructed neighboring block may be referred to as a spatial motionvector candidate.

The encoding apparatus 100 may generate a bitstream, and the bitstreammay include a motion vector candidate index. That is, the encodingapparatus 100 may generate a bitstream by entropy encoding the motionvector candidate index. The motion vector candidate index may indicatean optimum motion vector candidate that is selected from motion vectorcandidates included in the motion vector candidate list. The motionvector candidate index may be transmitted from the encoding apparatus100 to the decoding apparatus 200 through the bitstream.

The decoding apparatus 200 may entropy decode the motion vectorcandidate index from the bitstream, and may select a motion vectorcandidate of a decoding target block among the motion vector candidatesincluded in the motion vector candidate list by using the entropydecoded motion vector candidate index.

The encoding apparatus 100 may calculate a motion vector difference(MVD) between the motion vector and the motion vector candidate of thedecoding target block, and may entropy encode the MVD. The bitstream mayinclude the entropy encoded MVD. The MVD may be transmitted from theencoding apparatus 100 to the decoding apparatus 200 through thebitstream. Here, the decoding apparatus 200 may entropy decode thereceived MVD from the bitstream. The decoding apparatus 200 may derive amotion vector of the decoding target block through a sum of the decodedMVD and the motion vector candidate.

The bitstream may include a reference picture index indicating areference picture, etc., and a reference picture index may be entropyencoded and transmitted from the encoding apparatus 100 to the decodingapparatus 200 through the bitstream. The decoding apparatus 200 maypredict a motion vector of the decoding target block by using motioninformation of neighboring blocks, and may derive the motion vector ofthe decoding target block by using the predicted motion vector and themotion vector difference. The decoding apparatus 200 may generate theprediction block of the decoding target block on the basis of thederived motion vector and reference picture index information.

As another method of deriving the motion information, a merge mode isused. The merge mode may mean a merger of motions of a plurality ofblocks. The merge mode may mean application of motion information of oneblock to another block. When the merge mode is applied, the encodingapparatus 100 and the decoding apparatus 200 may respectively generate amerge candidate list by using motion information of the reconstructedneighboring block or motion information of the col block or both. Themotion information may include at least one of 1) the motion vector, 2)the reference picture index, and 3) the inter-prediction indicator. Aprediction indicator may indicate a uni-direction (L0 prediction, L1prediction) or a bi-direction.

Here, the merge mode may be applied to each CU or each PU. When themerge mode is performed at each CU or each PU, the encoding apparatus100 may generate a bitstream by entropy decoding predefined information,and may transmit the bitstream to the decoding apparatus 200. Thebitstream may include the predefined information. The predefinedinformation may include: 1) a merge flag that is information indicatingwhether or not the merge mode is performed for each block partition; and2) a merge index that is information to which a block among theneighboring blocks adjacent to the encoding target block is merged. Forexample, neighboring blocks adjacent to the encoding target block mayinclude a left neighboring block of the encoding target block, an upperneighboring block of the encoding target block, a temporally neighboringblock of the encoding target block, etc.

The merge candidate list may indicate a list storing motion information.In addition, the merge candidate list may be generated in advance ofperforming the merge mode. The motion information stored in the mergecandidate list may be at least one of motion information of theneighboring block adjacent to the encoding/decoding target block, motioninformation of the collocated block relative to the encoding/decodingtarget block in the reference picture, motion information newlygenerated by a combination of motion information that exists in themerge motion candidate list in advance, and a zero merge candidate.Here, motion information of the neighboring block adjacent to theencoding/decoding target block may be referred to as a spatial mergecandidate. Motion information of the collocated block relative to theencoding/decoding target block in the reference picture may be referredto as a temporal merge candidate.

A skip mode may be a mode applying the mode information of theneighboring block itself to the encoding/decoding target block. The skipmode may be one of modes used for inter prediction. When the skip modeis used, the encoding apparatus 100 may entropy encode information aboutmotion information of which block is used as motion information of theencoding target block, and may transmit the information to the decodingapparatus 200 through a bitstream. The encoding apparatus 100 may nottransmit other information, for example, syntax element information, tothe decoding apparatus 200. The syntax element information may includeat least one of motion vector difference information, a coded blockflag, and a transform coefficient level.

Based on the above-described description, a method of encoding/decodinga view according to the present invention will be described in detail.

FIG. 7 is a flowchart showing a method for encoding a video by using amerge mode according to the present invention. FIG. 8 is a flowchartshowing a method for decoding a video by using a merge mode according tothe present invention.

Referring to FIG. 7, an encoding apparatus may derive a merge candidateat step S701, and may generate a merge candidate list based on thederived merge candidate. When the merge candidate list is generated,motion information is determined by using the generated merge candidatelist at step S702, and motion compensation of the current block may beperformed by using the determined motion information at step S703. Next,the encoding apparatus may entropy encode information on motioncompensation at step S704.

Referring to FIG. 8, a decoding apparatus may entropy decode theinformation on motion compensation received from the encoding apparatusat step S801, and may derive the merge candidate at step S802, and maygenerate the merge candidate list based on the derived merge candidate.When the merge candidate list is generated, motion information of thecurrent block may be determined by using the generated merge candidatelist at step S803. Next, the decoding apparatus may perform motioncompensation by using the motion information at step S804.

Hereinafter, steps shown in FIGS. 7 and 8 will be described in detail.

First, deriving of the merge candidate at steps S701 and S802 will bedescribed in detail.

The merge candidate for the current block may include at least one of aspatial merge candidate, a temporal merge candidate, and an additionalmerge candidate.

The spatial merge candidate of the current block may be derived from areconstructed block neighboring the current block. For example, motioninformation of the reconstructed block neighboring the current block maybe determined as the spatial merge candidate for the current block.Here, the motion information may include at least one of a motionvector, a reference picture index, and a prediction list utilizationflag.

In this case, the motion information of the spatial merge candidate mayinclude motion information corresponding to L0 and L1 as well as motioninformation corresponding to L0, L1, . . . , LX. Here, X may be apositive integer including zero. Accordingly, a reference picture listmay include at least one of L0, L1, . . . , LX.

FIG. 9 is a view showing an example of deriving a spatial mergecandidate and a temporal merge candidate of a current block.

Referring to FIG. 9, the spatial merge candidate of the current blockmay be derived from neighbor blocks adjacent to the current block X. Theneighbor block adjacent to the current block may include at least one ofa block (B1) adjacent to the top of the current block, a block (A1)adjacent to the left of the current block, a block (B0) adjacent to thetop right corner of the current block, a block (B2) adjacent to the topleft corner of the current block, and a block (A0) adjacent to thebottom left corner of the current block.

In order to derive the spatial merge candidate of the current block,whether or not the neighbor block adjacent to the current block can beused in deriving the spatial merge candidate of the current block may bedetermined. Here, whether or not the neighbor block adjacent to thecurrent block can be used in deriving the spatial merge candidate of thecurrent block may be determined according to predetermined priorities.For example, in the example shown in FIG. 14, availability of derivingthe spatial merge candidate may be determined in the order of blocks atA1, B1, B0, A0, and B2 positions. The spatial merge candidatesdetermined based on the order for determining availability may be addedto the merge candidate list of the current block in sequence.

Next, a method of deriving a temporal merge candidate of the currentblock will be described.

The temporal merge candidate of the current block may be derived from areconstructed block included in a co-located picture of a currentpicture. Here, the co-located picture is a picture that has beenencoded/decoded before the current picture. The co-located picture maybe a picture having different temporal order (or picture order count(POC)) from the current picture.

In the meantime, the temporal merge candidate of the current block maybe derived from one or more blocks in the co-located picture, or may bederived from a plurality of blocks in a plurality of co-locatedpictures.

Information on the co-located picture may be transmitted from theencoder to the decoder or may be derived by the encoder/decoderaccording to an encoding/decoding order. Here, information on theco-located picture may be at least one of an inter prediction indicator,a reference picture index, and motion vector information.

Deriving of the temporal merge candidate may mean deriving temporalmerge candidate information from the co-located block in the co-locatedpicture and adding the temporal merge candidate information to the mergecandidate list of the current block. The temporal merge candidateinformation may include at least one of a motion vector, an referencepicture index, an inter prediction indicator, and a picture order count(POC).

Referring to FIG. 9, in the co-located picture of the current picture,the temporal merge candidate of the current block may be derived from ablock including an outer position of a block corresponding to spatiallythe same position as the current block X or from a block including aninner position of a block corresponding to spatially the same positionas the current block X. Here, the temporal merge candidate may meanmotion information of the co-located block. For example, the temporalmerge candidate of the current block X may be derived from a block Hadjacent to the bottom left corner of a block C corresponding tospatially the same position as the current block, or from a block C3including the center point of the block C. The block H or the block C3that is used to derive the temporal merge candidate of the current blockmay be referred to as ‘a co-located block’.

In the meantime, the co-located block of the current block or thecurrent block may have a square shape or a non-square shape.

When the temporal merge candidate of the current block can be derivedfrom the block H including the outer position of the block C, the blockH may be set to the co-located block of the current block. In this case,the temporal merge candidate of the current block may be derived basedon motion information of the block H. In contrast, when the temporalmerge candidate of the current block cannot be derived from the block H,the block C3 including the inner position of the block C may be set tothe co-located block of the current block. In this case, the temporalmerge candidate of the current block may be derived based on motioninformation of the block C3. When the temporal merge of the currentblock cannot be derived from the block H and the block C3 (for example,when both the block H and the block C3 are intra coded), the temporalmerge candidate of the current block may not be derived or may bederived from a block at a different position from the block H and theblock C3.

As another example, the temporal merge candidate of the current blockmay be derived from a plurality of blocks in the co-located picture. Forexample, a plurality of temporal merge candidates of the current blockmay be derived from the block H and the block C3.

As another example, the temporal merge candidate may be derived from aco-located block at a position moved according to random motioninformation with respect to the current block (X). Here, the randommotion information may be derived from motion information of theencoded/decoded neighbor block.

In the meantime, the co-located block may mean a block at apredetermined position included in a picture (co-located picture) usedto derive the motion information of the current block. Here, thepredetermined position may mean at least one of the same position as thecurrent block, the position adjacent to the current block, and theposition distanced from the current block by a predetermined distancewithin the co-located picture. The predetermined distance may be a fixeddistance preset in the encoder/decoder, or may be derived based on apredetermined vector component (including at least one of x componentand y component).

FIG. 10 is a view showing an example of adding a temporal mergecandidate to a merge candidate list.

Referring to FIG. 10, when one temporal merge candidate is derived froma co-located block at H1 position, the encoder/decoder may add thederived temporal merge candidate to the merge candidate list.

The co-located block of the current block may be partitioned intosub-blocks. In this case, among the sub-blocks of the co-located blockof the current block, the encoder/decoder may determine motioninformation of one sub-block as the temporal merge candidate of thecurrent block. Also, among the sub-blocks of the co-located block of thecurrent block, the encoder/decoder may determine motion information ofone sub-block as the temporal merge candidate of the current block.Here, the sub-block may mean a block that is smaller than the currentblock in size, shape, or depth.

For example, when at least one temporal merge candidate is derived bybeing partitioned into sub-blocks, the encoder/decoder may derive thetemporal merge candidate from a sub-block that is smaller in size,shape, or depth than the co-located block corresponding to the positionof block H or block C3 as shown in FIG. 9.

As another example, the encoder/decoder may derive at least one temporalmerge candidate from motion information of each sub-block of theco-located block at a position moved according to the random motioninformation with respect to the current block (X).

Here, the encoder/decoder may determine the temporal merge candidate ofthe current block by determining whether motion information of thesub-block of the co-located block exists or whether motion informationof the sub-block of the co-located block can be used as the temporalmerge candidate of the current block.

Also, the encoder/decoder may determine one of a median value, anaverage value, a minimum value, a maximum value, a weighted averagevalue or a mode of at least one piece (i.e., a motion vector) of motioninformation of sub-blocks of the co-located block as the temporal mergecandidate of the current block.

In FIG. 9, the temporal merge candidate of the current block can bederived from the block adjacent to the bottom left corner of theco-located block or from the block including the center point of theco-located block. However, the positions of the blocks for deriving thetemporal merge candidate of the current block are not limited to theexample shown in FIG. 9. For example, the temporal merge candidate ofthe current block may be derived from a block adjacent to the top/bottomboundary, the left/right boundary or a corner of the co-located block,and may be derived from a block including a particular position in theco-located block (i.e., a block adjacent to the corner boundary of theco-located block).

The temporal merge candidate of the current block may be determined byconsidering the reference picture lists (or prediction direction) of thecurrent block and the co-located block. In the meantime, motioninformation of the temporal merge candidate may include motioninformation corresponding to L0 and L1 as well as motion informationcorresponding to L0, L1, . . . , LX. Here, X may be a positive integerincluding zero.

For example, when the reference picture list that can be used by thecurrent block is L0 (namely, when the inter-prediction indicatorindicates PRED_L0), motion information corresponding to L0 in theco-located block may be derived as the temporal merge candidate of thecurrent block. That is, when the reference picture list that can be usedby the current block is LX (here, X is an integer such as 0, 1, 2 or 3indicating an index of the reference picture list), motion information(hereinafter, referred to as ‘LX motion information’) corresponding toLX of the co-located block may be derived as the temporal mergecandidate of the current block.

When the current block uses a plurality of reference picture lists, thetemporal merge candidate of the current block may be determined byconsidering the reference picture lists of the current block and theco-located block.

For example, when bi-directional prediction is performed on the currentblock (namely, the inter-prediction indicator is PRED_BI), at least twopieces of information selected from the group consisting of L0 motioninformation, L1 motion information, L2 motion information, . . . , andLX motion information of the co-located block may be derived as temporalmerge candidates. When tri-directional prediction is performed on thecurrent block (namely, the inter-prediction indicator is PRED_TRI), atleast three pieces of information selected from the group consisting ofL0 motion information, L1 motion information, L2 motion information, . .. , and LX motion information of the co-located block may be derived astemporal merge candidates. When quad-directional prediction is performedon the current block (namely, inter-prediction indicator is PRED_QUAD),at least four pieces of information selected from the group consistingof L0 motion information, L1 motion information, L2 motion information,. . . , and LX motion information of the co-located block may be derivedas temporal merge candidates.

Also, at least one of the temporal merge candidate, the co-locatedpicture, the co-located block, the prediction list utilization flag, andthe reference picture index may be derived based on at least one ofcoding parameters of the current block, the neighbor block, and theco-located block.

When the number of derived spatial merge candidates is less than themaximum number of merge candidates, the temporal merge candidate may bepreliminarily derived. Accordingly, when the number of derived spatialmerge candidates reaches the maximum number of merge candidates, aprocess of deriving the temporal merge candidate may be omitted.

For example, when the maximum number of merge candidates maxNumMergeCandis two and the two derived spatial merge candidates have differentvalues, a process of deriving the temporal merge candidate may beomitted.

In the meantime, within the maximum number of merge candidatesmaxNumMergeCand, at least one temporal merge candidate may be included.In this case, in order to include at least one temporal merge candidate,at least one of the derived spatial merge candidates is excluded or thederived spatial merge candidates are merged such that the number ofspatial merge candidates can be reduced. Here, the spatial mergecandidates are merged by using one of an average value, a maximum value,a minimum value, a median value, a weighted average value, and a mode ofmotion information between spatial merge candidates having the sameinter prediction indicator and/or reference picture.

Also, the encoder/decoder may change the maximum number of mergecandidates so as to include at least one temporal merge candidate.

As another example, the temporal merge candidate of the current blockmay be derived based on the maximum number of temporal merge candidates.Here, the maximum number of temporal merge candidates may be preset forthe encoding apparatus and the decoding apparatus to use the same value.Alternatively, information indicating the maximum number of temporalmerge candidates of the current block may be encoded through abitstream, and may be signaled to the decoding apparatus. For example,the encoding apparatus may encode maxNumTemporalMergeCand indicating themaximum number of temporal merge candidates of the current block, andmaxNumTemporalMergeCand may be signaled to the decoding apparatusthrough a bitstream. Here, maxNumTemporalMergeCand may be set to apositive integer including zero. For example, maxNumTemporalMergeCandmay be set to one. The value of maxNumTemporalMergeCand may be variouslyderived based on information on the number of temporal merge candidatesbeing signaled, and may be a fixed value preset in the encoder/decoder.

In the meantime, the encoder/decoder performs a redundancy check onwhether the derived merge candidate and the merge candidate added to themerge candidate list have different motion information, and may add thederived merge candidate having different motion information to the mergecandidate list.

When the distance between the current picture in which the current blockis included and the reference picture of the current block is differentfrom the distance between the co-located picture in which the co-locatedblock is included and the reference picture of the co-located block, amotion vector of the temporal merge candidate of the current block maybe obtained by scaling a motion vector of the co-located block.

Alternatively, even when reference for inter prediction of a pictureincluding the current block is different from reference for interprediction of a picture including the co-located block, the motionvector of the temporal merge candidate of the current block may beobtained by scaling the motion vector of the co-located block.

Here, scaling may be performed based on at least one of the distancebetween reference pictures referenced by the current picture and thecurrent block, and the distance between reference pictures referenced bythe co-located picture and the co-located block. For example, accordingto the ratio of the distance between reference pictures referenced bythe current picture and the current block and of the distance betweenreference pictures referenced by the co-located picture and theco-located block, the motion vector of the co-located block is scaled,thereby deriving the motion vector of the temporal merge candidate ofthe current block.

Based on the size (hereinafter, called ‘a first block size’) or thedepth (hereinafter, called ‘a first block depth’) of a block in whichinformation on motion compensation is entropy encoded/decoded, thetemporal merge candidate may be shared in blocks that are smaller thanthe first block size or deeper than the first block depth. Here, theinformation on motion compensation may be at least one of information onwhether or not a skip mode is used, information on whether or not amerge mode is used, and merge index information.

The block in which information on motion compensation is entropyencoded/decoded may be a CTU or a sub-unit of a CTU, a CU, or a PU.

Specifically, when the size of the current block is less than the firstblock size, the encoder/decoder may derive the temporal merge candidateof the current block from a co-located block of a higher block havingthe first block size. Also, the blocks included in the higher block mayshare the derived temporal merge candidate.

Also, when the depth of the current block is deeper than the first blockdepth, the encoder/decoder may derive the temporal merge candidate froma co-located block of a higher block having the first block depth. Also,the blocks included in the higher block may share the derived temporalmerge candidate.

Here, the sharing of the temporal merge candidate may mean thatrespective merge candidate lists of sharing blocks can be generatedbased on the same temporal merge candidate.

Also, the sharing of the temporal merge candidate may mean that sharingblocks can perform motion compensation by using one merge candidatelist. Here, shared merge candidate list may include the temporal mergecandidate derived based on a higher block in which information on motioncompensation is entropy encoded/decoded.

FIG. 11 is a view showing an example of scaling a motion vector ofmotion information of a co-located block to derive a temporal mergecandidate of a current block.

The motion vector of the co-located vector may be scaled based on atleast one of a difference value (td) between POC (Picture order count)indicating the display order of the co-located picture and POC of thereference picture of the co-located block, and a difference value (tb)between POC of the current picture and POC of the reference picture ofthe current block.

Before performing scaling, td or tb may be adjusted so that td or tbexists within a predetermined range. For example, when the predeterminedrange indicates −128˜127 and td or tb is less than −128, td or tb may beadjusted to −128. When td or tb is greater than 127, td or tb may beadjusted to 127. When td or tb is in the range of −128˜127, td or tb isnot adjusted.

A scaling factor DistScaleFactor may be calculated based on td or tb.Here, the scaling factor may be calculated based on the followingformula 1.DistScaleFactor=(tb*tx+32)>>6tx=(16384+Abs(td/2))/td  [Formula 1]

In formula 1, an absolute value function is designated as Abs( ), andthe output value of the function is the absolute value of the inputvalue.

The value of the scaling factor DistScaleFactor calculated based onformula 1 may be adjusted to a predetermined range. For example,DistScaleFactor may be adjusted to exist in a range of −1024˜1023.

By scaling the motion vector of the co-located block by using thescaling factor, the motion vector of the temporal merge candidate of thecurrent block may be determined. For example, the motion vector of thetemporal merge candidate of the current block may be determined by thefollowing formula 2.Sign(DistScaleFactor*mvCol)*((Abs(DistScaleFactor*mvCol)+127)>>8)  [Formula2]

In formula 2, Sign( ) is a function outputting sign information of thevalue in ( ). For example, Sign(−1) outputs −. In formula 2, the motionvector of the co-located block may be designated as mvCol.

As described above, a motion vector scaled according to a randomreference picture of the current block may be used as a motion vector ofthe temporal merge candidate of the current block. Alternatively, byusing scaling information of at least one block of the encoded/decodedneighbor blocks, the motion vector scaled by the temporal mergecandidate of the current block is corrected at least once, and may beused as a motion vector of the temporal merge candidate of the currentblock.

Next, a method of deriving an additional merge candidate of the currentblock will be described.

The additional merge candidate may mean at least one of a modifiedspatial merge candidate, a modified temporal merge candidate, a combinedmerge candidate, and a merge candidate having a predetermined motioninformation value. Here, the deriving of the additional merge candidatemay mean deriving the additional merge candidate and adding theadditional merge candidate to the merge candidate list.

The modified spatial merge candidate may mean a merge candidate in whichat least one piece of motion information of the derived spatial mergecandidate is modified.

The modified temporal merge candidate may mean a merge candidate inwhich at least one piece of motion information of the derived temporalmerge candidate is modified.

The combined merge candidate may mean a merge candidate derived bycombining at least one piece of motion information among motioninformation of the spatial merge candidate, the temporal mergecandidate, the modified spatial merge candidate, the modified temporalmerge candidate, the combined merge candidate, and the merge candidateshaving the predetermined motion information value that exist in themerge candidate list. Alternatively, the combined merge candidate maymean a merge candidate derived by combining at least one piece of motioninformation of a spatial merge candidate, a temporal merge candidate, amodified spatial merge candidate, a modified temporal merge candidate, acombined merge candidate, and a merge candidate having a predeterminedmotion information value. The spatial merge candidate and the temporalmerge candidate are derived from a block that does not exist in themerge candidate list but can be used to derive at least one of thespatial merge candidate and the temporal merge candidate. The modifiedspatial merge candidate and the modified temporal merge candidate aregenerated based on the spatial merge candidate and the temporal mergecandidate.

In the meantime, the merge candidate having a predetermined motioninformation value may mean a zero merge candidate where a motion vectoris (0, 0).

The zero merge candidate may mean a merge candidate of which a motionvector of at least one piece of L0 motion information, L1 motioninformation, L2 motion information, and L3 motion information is (0, 0).

Also, the zero merge candidate may be at least one of two types. Thefirst zero merge candidate may mean a merge candidate of which a motionvector is (0, 0) and a reference picture index has a value equal to orgreater than zero. The second zero merge candidate may mean a mergecandidate of which a motion vector is (0, 0) and a reference pictureindex has a value only zero.

Next, the determining of motion information of the current block byusing the generated merge candidate list at steps S702 and S803 will bedescribed in detail.

The encoder may determine a merge candidate being used in motioncompensation among merge candidates in the merge candidate list throughmotion estimation, and may encode a merge candidate index (merge_idx)indicating the determined merge candidate in a bitstream.

In the meantime, in order to generate the prediction block, the encodermay select a merge candidate from the merge candidate list based on themerge candidate index to determine motion information of the currentblock. Here, the prediction block of the current block may be generatedby performing motion compensation based on the determined motioninformation.

For example, when the merge candidate index is three, a merge candidateof the merge candidate list indicated by the merge candidate index 3 maybe determined as motion information, and may be used in motioncompensation of an encoding target block.

The decoder may decode the merge candidate index in the bitstream todetermine a merge candidate of the merge candidate list indicated by themerge candidate index. The determined merge candidate may be determinedas motion information of the current block. The determined motioninformation may be used in motion compensation of the current block.Here, motion compensation may mean inter prediction.

For example, when the merge candidate index is two, a merge candidate ofthe merge candidate list indicated by the merge candidate index 2 may bedetermined as motion information, and may be used in motion compensationof a decoding target block.

Also, by changing at least one value of information corresponding tomotion information of the current block, the motion information may beused in inter prediction or motion compensation of the current block.Here, the changed value of information corresponding to motioninformation may be at least one of x component of the motion vector, ycomponent of the motion vector, and the reference picture index.

Next, the performing of motion compensation of the current block byusing the determined motion information at steps S703 and S804 will bedescribed in detail.

The encoder and decoder may perform inter prediction or motioncompensation by using motion information of the determined mergecandidate. Here, the current block (encoding/decoding target block) mayhave motion information of the determined merge candidate.

The current block may have at least one to at most N pieces of motioninformation according to prediction direction. At least one to at most Nprediction blocks may be generated by using motion information to derivethe final prediction block of the current block.

For example, when the current block has one piece of motion information,the prediction block generated by using the motion information may bedetermined as the final prediction block of the current block.

In contrast, when the current block has several pieces of motioninformation, several prediction blocks may be generated by using theseveral pieces of motion information, and the final prediction block ofthe current block may be determined based on a weighted sum of theseveral prediction blocks. Reference pictures respectively including theseveral prediction blocks indicated by several pieces of motioninformation may be included in different reference picture lists, andmay be included in the same reference picture list. Also, when thecurrent block has several pieces of motion information, several piecesof motion information of several reference pictures may indicate thesame reference picture.

For example, a plurality of prediction blocks may be generated based onat least one of the spatial merge candidate, the temporal mergecandidate, the modified spatial merge candidate, the modified temporalmerge candidate, the merge candidate having the predetermined motioninformation value or the combined merge candidate, and the additionalmerge candidate. The final prediction block of the current block may bedetermined based on the weighted sum of the plurality of predictionblocks.

As another example, a plurality of prediction blocks may be generatedbased on merge candidates indicated by a preset merge candidate index.The final prediction block of the current block may be determined basedon the weighted sum of the plurality of prediction blocks. Also, aplurality of prediction blocks may be generated based on mergecandidates that exist in a preset merge candidate index range. The finalprediction block of the current block may be determined based on theweighted sum of the plurality of prediction blocks.

The weighting factor applied to each prediction block may have the samevalue by 1/N (here, N is the number of generated prediction blocks). Forexample, when two prediction blocks are generated, the weighting factorbeing applied to each prediction block may be ½. When three predictionblocks are generated, the weighting factor being applied to eachprediction block may be ⅓. When four prediction blocks are generated,the weighting factor being applied to each prediction block may be ¼.Alternatively, the final prediction block of the current block may bedetermined by applying different weighting factors to prediction blocks.

The weighting factor does not have to have a fixed value for eachprediction block, and may have a variable value for each predictionblock. Here, the weighting factors being applied to prediction blocksmay be the same, and may be different from each other. For example, whentwo prediction blocks are generated, weighting factors being applied tothe two prediction blocks may be a variable value for each block such as(½, ½), (⅓, ⅔), (¼, ¾), (⅖, ⅗), (⅜, ⅝), etc. In the meantime, theweighting factor may be a positive real number and a negative realnumber. For example, the weighting factor may be a negative real numbersuch as (−½, 3/2), (−⅓, 4/3), (−¼, 5/4), etc.

In the meantime, in order to apply a variable weighting factor, at leastone piece of weighting factor information for the current block may besignaled through a bitstream. The weighting factor information may besignaled for each prediction block, and may be signaled for eachreference picture. A plurality of prediction blocks may share one pieceof weighting factor information.

The encoder and the decoder may determine whether or not motioninformation of the merge candidate is used based on a prediction blocklist utilization flag. For example, when a prediction block listutilization flag indicates one, which is a first value, for eachreference picture list, it may indicate that the encoder and the decodercan use motion information of the merge candidate of the current blockto perform inter prediction or motion compensation. When a predictionblock list utilization flag indicates zero which is a second value, itmay indicate that the encoder and the decoder do not perform interprediction or motion compensation by using motion information of themerge candidate of the current block. In the meantime, the first valueof the prediction block list utilization flag may be set to zero, andthe second value thereof may be set to one.

The following formula 3 to formula 5 show examples of generating thefinal prediction block of the current block, when the inter-predictionindicator of each current block is PRED_BI (or when the current blockcan use two pieces of motion information), PRED_TRI (or when the currentblock can use three pieces of motion information), and PRED_QUAD (orwhen the current block can use four pieces of motion information) andprediction direction for each reference picture list is uni-direction.P_BI=(WF_L0*P_L0+OFFSET_L0+WF_L1*P_L1+OFFSET_L1+RF)>>1  [Formula 3]P_TRI=(WF_L0*P_L0+OFFSET_L0+WF_L1*P_L1+OFFSET_L1+WF_L2*P_L2+OFFSET_L2+RF)/3  [Formula4]P QUAD=(WF L0*P L0+OFFSET L0+WF L1*P L1+OFFSET L2*P L2+OFFSET L2+WF L3*PL3+OFFSET L3+RF)>>2  [Formula 5]

In formulas 3 to 5, the final prediction block of the current block maybe designated as P_BI, P_TRI, and P_QUAD, and the reference picture listmay be designated as LX (X=0, 1, 2, 3). A weighting factor value of theprediction block generated by using LX may be designated as WF_LX. Anoffset value of the prediction block generated by using LX may bedesignated as OFFSET_LX. A prediction block generated by using motioninformation for LX of the current block may be designated as P_LX. Arounding factor may be designated as RF, and may be set to zero, apositive number, or a negative number. The LX reference picture list mayinclude at least one of a long-term reference picture, a referencepicture on which deblocking filter is not performed, a reference pictureon which sample adaptive offset is not performed, a reference picture onwhich adaptive loop filter is not performed, a reference picture onwhich deblocking filter and adaptive offset are performed, a referencepicture on which deblocking filter and adaptive loop filter isperformed, a reference picture on which sample adaptive offset andadaptive loop filter are performed, a reference picture on whichdeblocking filter, sample adaptive offset, and adaptive loop filter areperformed. In this case, the LX reference picture list may be at leastone of an L0 reference picture list, an L1 reference picture list, an L2reference picture list, and an L3 reference picture list.

When the prediction direction for a predetermined reference picture listis a plurality of directions, the final prediction block for the currentblock may be obtained based on the weighted sum of the predictionblocks. Here, weighting factors being applied to prediction blocksderived from the same reference picture list may have the same value,and may have different values.

At least one of a weighting factor (WF_LX) and an offset (OFFSET_LX) fora plurality of prediction blocks may be a coding parameter being entropyencoded/decoded.

As another example, a weighting factor and an offset may be derived froman encoded/decoded neighbor block adjacent to the current block. Here,the neighbor block of the current block may include at least one of ablock being used in deriving the spatial merge candidate of the currentblock and a block being used in deriving the temporal merge candidate ofthe current block.

As another example, a weighting factor and an offset may be determinedbased on a display order (POC) of the current picture and referencepictures. In this case, when the current picture is far from thereference picture, the weighting factor or the offset may be set to asmall value. When the current picture is close to the reference picture,the weighting factor or the offset may be set to a large value. Forexample, when the POC difference between the current picture and L0reference picture is two, the weighting factor value being applied tothe prediction block generated by referring to L0 reference picture maybe set to ⅓. In contrast, when the POC difference between the currentpicture and L0 reference picture is one, the weighting factor valuebeing applied to the prediction block generated by referring to L0reference picture may be set to ⅔. As described above, the weightingfactor or offset value may be in inverse proportion to the display orderdifference between the current picture and the reference picture. Asanother example, the weighting factor or offset value may be inproportion to the display order difference between the current pictureand the reference picture.

As another example, based on at least one of coding parameters of thecurrent block, the neighbor block, and the co-located block, at leastone of a weighting factor and an offset may be entropy encoded/decoded.Also, based on at least one of coding parameters of the current block,the neighbor block, and the co-located block, the weighted sum ofprediction blocks may be calculated.

The weighted sum of a plurality of prediction blocks may be applied toonly a partial area in the prediction block. Here, the partial area maybe an area corresponding to the boundary in the prediction block. Asdescribed above, in order to apply the weighted sum to only the partialarea, the weighted sum may be applied for each sub-block of theprediction block.

Also, when calculating a weighted sum of prediction blocks by using amerge mode, the weighted sum may be calculating by using at least onemerge candidate existing in the merge candidate list, and may be used asthe final prediction block of the encoding/decoding target block.

For example, the weighted sum of prediction blocks generated by usingthe spatial merge candidates may be calculated, and the calculatedweighted sum may be used as the final prediction block of theencoding/decoding target block.

For example, the weighted sum of prediction blocks generated by usingthe spatial merge candidate and the temporal merge candidates may becalculated, and the calculated weighted sum may be used as the finalprediction block of the encoding/decoding target block.

For example, the weighted sum of prediction blocks generated by usingthe combined merge candidates may be calculated, and the calculatedweighted sum may be used as the final prediction block of theencoding/decoding target block.

For example, the weighted sum of prediction blocks generated by usingmerge candidates having particular merge candidate indexes may becalculated, and the calculated weighted sum may be used as the finalprediction block of the encoding/decoding target block.

For example, the weighted sum of prediction blocks generated by usingmerge candidates existing within a particular merge candidate indexrange may be calculated, and the calculated weighted sum may be used asthe final prediction block of the encoding/decoding target block.

Next, the entropy encoding/decoding of information on motioncompensation at steps S704 and S801 will be described in detail.

The encoding apparatus may entropy encode information on motioncompensation through a bitstream, and the decoding apparatus may entropydecode information on motion compensation included in the bitstream.Here, information on motion compensation being entropy encoded/decodedmay include at least one of information on whether or not a skip mode isused (cu_skip_flag), information on whether or not a merge mode is used(merge_flag), merge index information (merge_index), an inter-predictionindicator (inter_pred_idc), a weighting factor value (wf_10, wf_11,wf_12, wf_13), and an offset value (offset_10, offset_11, offset_12,offset_13). Information on motion compensation may be entropyencoded/decoded in at least one of a CTU, a coding block, and aprediction block.

When information on whether or not a skip mode is used (cu_skip_flag)has one which is a first value, it may indicate the use of the skipmode. When it has two which is a second value, it may not indicate theuse of the skip mode. Motion compensation of the current block may beperformed by using the skip mode based on the information on whether ornot a skip mode is used.

When information on whether or not a merge mode is used (merge_flag) hasone which is a first value, it may indicate the use of the merge mode.When it has zero which is a second value, it may not indicate the use ofthe merge mode. Motion compensation of the current block may beperformed by using the merge mode based on the information on whether ornot a merge mode is used.

The merge index information (merge_index) may mean informationindicating a merge candidate in the merge candidate list.

Also, the merge index information may mean information on a merge index.

Also, the merge index information may indicate a block, which derived amerge candidate, among reconstructed blocks spatially/temporallyadjacent to the current block.

Also, the merge index information may indicate at least one piece ofmotion information of the merge candidate. For example, when the mergeindex information has zero that is a first value, it may indicate thefirst merge candidate in the merge candidate list. When it has one thatis a second value, it may indicate the second merge candidate in themerge candidate list. When it has two that is a third value, it mayindicate the third merge candidate in the merge candidate list. In thesame manner, when it has a fourth value to N-th value, it may indicate amerge candidate corresponding to the value according to the order in themerge candidate list. Here, N may mean a positive integer includingzero.

Motion compensation of the current block may be performed by using themerge mode based on merge mode index information.

When the current block is encoded/decoded in inter prediction, theinter-prediction indicator may mean at least one of inter predictiondirection and the number of prediction directions of the current block.For example, the inter-prediction indicator may indicate uni-directionalprediction, or multi-directional prediction such as bi-directionalprediction, tri-directional prediction, quad-directional prediction,etc. The inter-prediction indicator may mean the number of referencepictures being used when the current block generates the predictionblock. Alternatively, one reference picture may be used formulti-directional prediction. In this case, M reference pictures areused to perform N(N>M)-directional prediction. The inter-predictionindicator may mean inter prediction for the current block or the numberof prediction blocks being used in performing motion compensation.

As described above, according to the inter-prediction indicator, thenumber of reference pictures being used in generating the predictionblock of the current block, the number of prediction blocks being usedin performing inter prediction or motion compensation of the currentblock, or the number of reference picture lists available to the currentblock, etc. may be determined. Here, the number of reference picturelists is N that is a positive integer such as 1, 2, 3, 4 or more. Forexample, the reference picture list may include L0, L1, L2, L3, etc.Motion compensation may be performed on the current block by using atleast one reference picture list.

For example, the current block may generate at least one predictionblock by using at least one reference picture list to perform motioncompensation of the current block. For example, one or more predictionblocks may be generated by using reference picture list L0 to performmotion compensation. Alternatively one or more prediction blocks may begenerated by using reference picture lists L0 and L1 to perform motioncompensation. Alternatively, one or more prediction block or at most Nprediction blocks (here, N is a positive integer equal to or greaterthan three or two) may be generated by using reference picture lists L0,L1 and L2 to perform motion compensation. Alternatively, one or moreprediction blocks or at most N prediction blocks (here, N is a positiveinteger equal to or greater than four or two) may be generated by usingreference picture lists L0, L1, L2 and L3 to perform motion compensationof the current block.

The reference picture indicator may indicate uni-direction (PRED_LX),bi-direction (PRED_BI), tri-direction (PRED_TRI), quad-direction(PRED_QUAD) or greater direction depending on the number of predictiondirections of the current block.

For example, when uni-directional prediction is performed for eachreference picture list, the inter-prediction indicator PRED_LX may meanthat one prediction block is generated by using a reference picture listLX (X is an integer such as 0, 1, 2, or 3, etc.) and inter prediction ormotion compensation is performed by using the generated one predictionblock. The inter-prediction indicator PRED_BI may mean that twoprediction blocks are generated by using at least one of L0, L1, L2 andL3 reference picture lists and inter prediction or motion compensationis performed by using the generated two prediction blocks. Theinter-prediction indicator PRED_TRI may mean that three predictionblocks are generated by using at least one of L0, L1, L2, and L3reference picture lists and inter prediction or motion compensation isperformed by using the generated three prediction blocks. Theinter-prediction indicator PRED_QUAD may mean that four predictionblocks are generated by using at least one of L0, L1, L2, and L3reference picture lists and inter prediction or motion compensation isperformed by using the generated four prediction blocks. That is, thesum of the number of prediction blocks used in performing interprediction of the current block may be set to the inter-predictionindicator.

When performing multi-directional prediction for the reference picturelist, the inter-prediction indicator PRED_BI may mean performingbi-directional prediction for the L0 reference picture list. Theinter-prediction indicator PRED_TRI may mean: performing tri-directionalprediction for the L0 reference picture list; performing uni-directionalprediction for the L0 reference picture list, and performingbi-directional prediction for the L1 reference picture list; orperforming bi-directional prediction for the L0 reference picture listand performing uni-directional prediction for the L1 reference picturelist.

As described above, the inter-prediction indicator may mean that atleast one to at most N (here, N is the number of prediction directionsindicated by the inter-prediction indicator) prediction blocks aregenerated from at least one reference picture list so as to performmotion compensation. Alternatively, the inter-prediction indicator maymean that at least one to at most N prediction blocks are generated fromN reference pictures and motion compensation for the current block isperformed by using the generated prediction block.

For example, the inter-prediction indicator PRED_TRI may mean that threeprediction blocks are generated by using at least one of L0, L1, L2, andL3 reference picture lists so as to perform inter prediction or motioncompensation of the current block. Alternatively, the inter-predictionindicator PRED_TRI may mean that three prediction blocks are generatedby using at least three selected from the group consisting of L0, L1,L2, and L3 reference picture lists so as to perform inter prediction ormotion compensation of the current block. Also, the inter-predictionindicator PRED_QUAD may mean that four prediction blocks are generatedby using at least one of L0, L1, L2, and L3 reference picture lists soas to perform inter prediction or motion compensation of the currentblock. Alternatively, the inter-prediction indicator PRED_QUAD may meanthat four prediction blocks are generated by using at least fourselected from the group consisting of L0, L1, L2, and L3 referencepicture lists so as to perform inter prediction or motion compensationof the current block.

Available inter prediction directions may be determined according to theinter-prediction indicator, and all or some of the availableinter-prediction directions may be selectively used based on the sizeand/or shape of the current block.

A prediction list utilization flag indicates whether or not theprediction block is generated by using the reference picture list.

For example, when the prediction list utilization flag indicates onewhich is a first value, it may indicate that the prediction block isgenerated by using the reference picture list. When it indicates zerowhich is a second value, it may indicate that the prediction block isnot generated by using the reference picture list. Here, the first valueof the prediction list utilization flag may be set to zero, and thesecond value thereof may be set to one.

That is, when the prediction list utilization flag indicates the firstvalue, the prediction block of the current block may be generated byusing motion information corresponding to the reference picture list.

In the meantime, the prediction list utilization flag may be set basedon the inter-prediction indicator. For example, when theinter-prediction indicator indicates PRED_LX, PRED_BI, PRED_TRI orPRED_QUAD, the prediction list utilization flag predFlagLX may be set toone which is a first value. When the inter-prediction indicator isPRED_LN (N is a positive integer other than X), the prediction listutilization flag predFlagLX may be set to zero which is a second value.

Also, the inter-prediction indicator may be set based on the predictionlist utilization flag. For example, when the prediction list utilizationflag predFlagL0 and the predFlagL1 indicate one which is a first value,the inter-prediction indicator may be set to PRED_BI. For example, whenonly the prediction list utilization flag predFlagL0 indicate one whichis a first value, the inter-prediction indicator may be set to PRED_L0.

At least one piece of the above-described information on motioncompensation may be entropy encoded/decoded in at least one of a CTU anda sub-unit of a CTU (sub-CTU). Here, the sub-unit of the CTU may includeat least one of a CU and a PU. A block of the sub-unit of the CTU mayhave a square shape or a non-square shape. Information on motioncompensation may mean at least one piece of information on motioncompensation for convenience.

When information on motion compensation is entropy encoded/decoded inthe CTU, motion compensation may be performed on all or a part of blocksexisting in the CUT by using information on the motion compensationaccording to a value of information on motion compensation.

When information on motion compensation is entropy encoded/decoded inthe CTU or the sub-unit of the CTU, information on motion compensationmay be entropy encoded/decoded based on at least one of the size and thedepth of the predetermined block.

Here, information on the size or the depth of the predetermined blockmay be entropy encoded/decoded. Alternatively, information on the sizeor the depth of the predetermined block may be determined based on atleast one of a preset value in the encoder and the decoder and a codingparameter or based at least one of another syntax element values.

Information on motion compensation may be entropy encoded/decoded inonly a block that is larger than or equal to the predetermined block insize, and information on motion compensation may not be entropyencoded/decoded in a block that is smaller than the predetermined blockin size. In this case, motion compensation may be performed onsub-blocks in a block that is larger than or equal to the predeterminedblock in size based on information on motion compensation that isentropy encoded/decoded in a block that is larger than or equal to thepredetermined block in size. That is, sub-blocks in a block that islarger than or equal to the predetermined block in size may shareinformation on motion compensation including a motion vector candidate,a motion vector candidate list, a merge candidate, a merge candidatelist, etc.

Information on motion compensation may be entropy encoded/decoded inonly a block that is shallower than or equal to the predetermined blockin depth, and information on motion compensation may not be entropyencoded/decoded in a block that is deeper than the predetermined blockin depth. In this case, motion compensation may be performed onsub-blocks in a block that is shallower than or equal to thepredetermined block in depth based on information on motion compensationentropy encoded/decoded in a block that is shallower than or equal tothe predetermined block in depth. That is, sub-blocks in a block that isshallower than or equal to the predetermined block in depth may shareinformation on motion compensation including a motion vector candidate,a motion vector candidate list, a merge candidate, a merge candidatelist, etc.

For example, when information on motion compensation is entropyencoded/decoded in the sub-unit, of which the size is 32×32, of the CTU,of which the block size is 64×64, motion compensation may be performedon a block that is included in a 32×32-size block and is smaller thanthe 32×32-size block in size based on information on motion compensationthat is entropy encoded/decoded in the 32×32-size block.

As another example, when information on motion compensation is entropyencoded/decoded in the sub-unit, of which the size is 16×16, of the CTU,of which the block size is 128×128, motion compensation may be performedon a block that is included in a 16×16-size block and is smaller than orequal to the 16×16-size block in size based on information on motioncompensation that is entropy encoded/decoded in the 16×16-size block.

As another example, when information on motion compensation is entropyencoded/decoded in the sub-unit, of which the block depth is one, of theCTU, of which the block depth is zero, motion compensation may beperformed on a block that is included in a one-depth block and is deeperthan the one-depth block in depth based on information on motioncompensation that is entropy encoded/decoded in the one-depth block.

For example, when at least one piece of information on motioncompensation is entropy encoded/decoded in the sub-unit, of which theblock depth is two, of the CTU, of which the block depth is zero, motioncompensation may be performed on a block that is included in a two-depthblock and is equal to or is deeper than the two-depth block in depthbased on information on motion compensation that is entropyencoded/decoded in the two-depth block.

Here, the value of the block depth may be a positive integer includingzero. When the value of the block depth is large, it may mean that thedepth is deep. When the value of the block depth is small, it may meanthat the depth is shallow. Accordingly, when the value of the blockdepth is large, the block size may be small. When the value of the blockdepth is small, the block size may be large. Also, a sub-block of apredetermined block may be deeper than the predetermined block in depth,and a sub-block of a predetermined block may be deeper than thepredetermined block in depth within a block corresponding to thepredetermined block.

Information on motion compensation may be entropy encoded/decoded foreach block, and may be entropy encoded/decoded at a higher level. Forexample, information on motion compensation may be entropyencoded/decoded for each block such as a CTU, a CU, or a PU, etc., ormay be entropy encoded/decoded at a higher lever such as a VideoParameter Set, a Sequence Parameter Set, a Picture Parameter Set, anAdaptation Parameter Set or a slice Header, etc.

Information on motion compensation may be entropy encoded/decoded basedon an information difference value on motion compensation indicating adifference value between information on motion compensation and aninformation prediction value on motion compensation. Considering theinter-prediction indicator which is one piece of information on motioncompensation as an example, the inter-prediction indicator predictionvalue and the inter-prediction indicator difference value may be entropyencoded/decoded. Here, the inter-prediction indicator difference valuemay be entropy encoded/decoded for each block, and the inter-predictionindicator prediction value may be entropy encoded/decoded at a higherlevel. The information prediction value on motion compensation such asthe inter-prediction indicator prediction value, etc. is entropyencoded/decoded for each picture or slice, blocks in the picture or theslice may use a common information prediction value on motioncompensation.

The information prediction value on motion compensation may be derivedthrough a particular area within an image, a slice or a tile, or througha particular area within a CTU or a CU. For example, theinter-prediction indicator of the particular area in the image, slice,tile, CTU, or CU may be used as the inter-prediction indicatorprediction value. In this case, entropy encoding/decoding of theinformation prediction value on motion compensation may be omitted, andonly the information difference value on motion compensation may beentropy encoded/decoded.

Alternatively, the information prediction value on motion compensationmay be derived from an encoded/decoded neighbor block adjacent to thecurrent block. For example, the inter-prediction indicator of theencoded/decoded neighbor block adjacent to the current block may be setto the inter-prediction indicator prediction value of the current block.Here, the neighbor block of the current block may include at least oneof a block used in deriving the spatial merge candidate and a block usedin deriving the temporal merge candidate. Also, the neighbor block mayhave the same depth as or the smaller depth than that of the currentblock. When there is a plurality of neighbor blocks, one may beselectively used according to the predetermined priority. The neighborblock used to predict information on motion compensation may have afixed position based on the current block, and may have a variableposition according to the position of the current block. Here, theposition of the current block may be a position based on a picture or aslice including the current block, or may be a position based on aposition of a CTU, a CU, or a PU including the current block.

The merge index information may be calculated by using index informationin the predetermined sets in the encoder and the decoder.

When using the information prediction value on motion compensation andthe information difference value on motion compensation, the decodingapparatus may calculate an information value on motion compensation forthe prediction block by adding the information prediction value onmotion compensation and the information difference value on motioncompensation.

Information on motion compensation or the information difference valueon motion compensation may be entropy encoded/decoded based on at leastone of coding parameters of the current block, the neighbor block, andthe co-located block.

Based on at least one of coding parameters of the current block, theneighbor block, and the co-located block, information on motioncompensation, information prediction value on motion compensation, orinformation difference value on motion compensation may be derived asinformation on motion compensation, information prediction value onmotion compensation or information difference value on motioncompensation of the current block.

Instead of entropy encoding/decoding information on motion compensationof the current block, information on motion compensation of theencoded/decoded block adjacent to the current block may be used asinformation on motion compensation of the current block. For example,the inter-prediction indicator of the current block may be set to thesame value as the inter-prediction indicator of the encoded/decodedneighbor block adjacent to the current block.

Also, at least one piece of information on motion compensation may havea fixed value preset in the encoder and the decoder. The preset fixedvalue may be determined as a value for at least one piece of informationon motion compensation. Blocks which are smaller than a particular blockin size within the particular block may share at least one piece ofinformation on motion compensation having the preset fixed value. In thesame manner, blocks which are deeper than a particular block in depthand are sub-blocks of the particular block may share at least one pieceof information on motion compensation having the preset fixed value.Here, the fixed value may be a positive integer including zero, or maybe an integer vector value including (0, 0).

Here, sharing at least one piece of information on motion compensationmay mean that blocks have the same value for at least one piece ofinformation on motion compensation, or that motion compensation isperformed on the blocks by using the same value for at least one pieceof information on motion compensation.

Information on motion compensation may further include at least one of amotion vector, a motion vector candidate, a motion vector candidateindex, a motion vector difference value, a motion vector predictionvalue, information on whether or not a skip mode is used (skip_flag),information on whether or not a merge mode is used (merge_flag), mergeindex information (merge_index), motion vector resolution information,overlapped block motion compensation information, local illuminationcompensation information, affine motion compensation information,decoder-side motion vector derivation information, and bi-directionaloptical flow information.

Motion vector resolution information may be information indicatingwhether or not particular resolution is used for at least one of amotion vector and a motion vector difference value. Here, resolution maymean precision. Also, particular resolution may set to at least one ofan integer-pixel (integer-pel) unit, a ½-pixel (½-pel) unit, a ¼-pixel(¼-pel) unit, a ⅛-pixel (⅛-pel) unit, a 1/16-pixel ( 1/16-pel) unit, a1/32-pixel ( 1/32-pel) unit, and a 1/64-pixel ( 1/64-pel) unit.

Overlapped block motion compensation information may be informationindicating whether or not the weighted sum of the prediction block ofthe current block is calculated by using a motion vector of the neighborblock spatially adjacent to the current block during motion compensationof the current block.

Local illumination compensation information may be informationindicating whether or not at least one of a weighting factor value andan offset value is applied when generating the prediction block of thecurrent block. Here, at least one of the weighting factor value and theoffset value may be a value calculated based on a reference block.

Affine motion compensation information may be information indicatingwhether or not an affine motion model is used during motion compensationof the current block. Here, the affine motion model may be a model forpartitioning one block into several sub-blocks by using a plurality ofparameters, and calculating motion vectors of the partitioned sub-blocksby using representative motion vectors.

Decoder-side motion vector derivation information may be informationindicating whether or not a motion vector required for motioncompensation is used by being derived by the decoder. Information on amotion vector may not be entropy encoded/decoded based on decoder-sidemotion vector derivation information. Also, when decoder-side motionvector derivation information indicates that the decoder derives anduses a motion vector, information on a merge mode may be entropyencoded/decoded. That is, decoder-side motion vector derivationinformation may indicate whether or not a merge mode is used in thedecoder.

Bi-directional optical flow information may be information indicatingwhether or not motion compensation is performed by correcting a motionvector for each pixel or sub-block. Based on bi-directional optical flowinformation, a motion vector for each pixel or sub-block may not beentropy encoded/decoded. Here, motion vector correction may be modifyinga motion vector value from a motion vector for each block into a motionvector for each pixel or sub-block.

Motion compensation is performed on the current block by using at leastone piece of information on motion compensation, and at least one pieceof information on motion compensation may be entropy encoded/decoded.

When entropy encoding/decoding information on motion compensation, abinarization method such as a truncated rice binarization method, a K-thorder Exp_Golomb binarization method, a limited K-th order Exp_Golombbinarization method, a fixed-length binarization method, a unarybinarization method, or a truncated unary binarization method, etc. maybe used.

When entropy encoding/decoding information on motion compensation, acontext model may be determined by using at least one piece ofinformation on motion compensation of a neighbor block adjacent to thecurrent block or area information of the neighbor block, information onpreviously encoded/decoded motion compensation or previouslyencoded/decoded area information, information on the depth of thecurrent block, and information on the size of the current block.

Also, when entropy encoding/decoding information on motion compensation,entropy encoding/decoding may be performed by using at least one pieceof information on motion compensation of the neighbor block, informationon previously encoded/decoded motion compensation, information on thedepth of the current block, and the information on the size of thecurrent block as a prediction value for information on motioncompensation of the current block.

A method of encoding/decoding a video by using a merge mode has beendescribed with reference to FIGS. 7 to 11. Hereinafter, a method ofderiving a temporal merge candidate will be described in detail withreference to FIGS. 12 to 15.

The encoder/decoder may derive a temporal merge candidate from at leastone block reconstructed in a temporal neighbor reference picture of thecurrent block. Here, the temporal neighbor reference picture of thecurrent block may be a co-located picture.

Information on the co-located picture (for example, at least one of aninter prediction indicator, reference picture index, motion vectorinformation, and picture order count (POC)) may be transmitted from theencoder to the decoder for each at least one of a sequence, a picture, aslice, a tile, a CTU, a CU, and a PU.

Also, information on the co-located picture may be derived by theencoder/decoder by using at least one of hierarchy according to anencoding/decoding order, motion information of an encoded/decodedtemporal candidate block/spatial candidate block, an inter predictionindicator for a picture of a high level such as a sequence, a picture, aslice, a tile, etc., and reference picture index information.

Here, deriving of the temporal merge candidate may mean derivingtemporal merge candidate information (for example, at least one of amotion vector, a reference picture index, an inter prediction indicator,a picture order count) from the co-located block in the co-locatedpicture and adding the derived temporal merge candidate information tothe merge candidate list of the current block.

The position of the co-located block may be the same as the position ofthe current block in the co-located picture. Also, the position of theco-located block may be the position moved with respect to the positionof the current block by using at least one of motion vectors of theencoded/decoded temporal/spatial candidate block.

For example, assuming that a co-located picture of a picture (or aslice) level including the current block is set as a first referencepicture in L1 direction, the spatial candidate blocks are scanned formotion information of L1 direction according to a random order. Whenthere is motion information for the L1 direction, the motion informationis used to derive the co-located block for the current block. Here, thespatial candidate block may be a neighbor block of the current block forderiving the spatial merge candidate in FIG. 9.

As another example, assuming that a co-located picture of a picture (ora slice) level including the current block is set as a first referencepicture in L1 direction, spatial candidate blocks are scanned for motioninformation of L1 direction according to a random order. When there isno motion information for L1 direction, motion information for L0direction may be scanned. Here, when there is motion information for L1direction, the co-located block for the current block may be derived byusing the motion information.

In deriving the temporal merge candidate for the current block, as shownin FIG. 11, the motion vector of each reference picture list from theco-located block may be scaled according to the random reference pictureof the current block.

Also, the motion vector obtained from the co-located block is scaled tocorrespond to at least one of all reference pictures that can bereferenced in the current block such that a plurality of scaled motionvectors is derived. The scaled motion vectors corresponding torespective reference pictures may be used to generate a plurality ofprediction blocks. Here, the final prediction block of the current blockmay be generated by using a weighted sum of the generated plurality ofprediction blocks.

In the meantime, by using the above-described method, the temporal mergecandidate for the sub-block of the current block may be derived, and thefinal prediction block of the sub-block of the current block may begenerated.

For each reference picture list, a distance (difference value of POC)between a picture including a current block (or a sub-block of thecurrent block) and a reference picture of the current block (or asub-block of the current block) is different from a distance (differencevalue of POC) between a co-located picture and a reference picture of aco-located block (or a sub-block of the co-located block), the motionvector derived from the co-located block (or a sub-block of theco-located block) may be scaled to derive a temporal merge candidate.

Also, for each reference picture list, when a reference picture of thecurrent block (or a sub-block of the current block) is different from areference picture of the co-located block (or a sub-block of theco-located block), the motion vector derived from the co-located block(or a sub-block of the co-located block) may be scaled to derive atemporal merge candidate.

Also, for each reference picture list, when a distance (difference valueof POC) between a picture (current picture) including a current block(or a sub-block of the current block) and a reference picture of thecurrent block (or a sub-block of the current block) is different from adistance (difference value of POC) between a co-located picture and areference picture of the co-located block (or a sub-block of theco-located block), and for each reference picture list, when a referencepicture of the current block (or a sub-block of the current block) isdifferent from a reference picture of the co-located block (or asub-block of the co-located block), the motion vector derived from theco-located block (or a sub-block of the co-located block) may be scaledto derive a temporal merge candidate. Here, the reference picture listmay be at least one reference picture list such as L0, L1, . . . , LX,etc. (X is a positive integer) according to the inter predictionindicator.

Here, in scaling the motion vector derived from the co-located block (ora sub-block of the co-located block), a reference picture of the currentblock (or a sub-block of the current block) may be determined for eachreference picture list, and a motion vector may be scaled according tothe determined reference picture.

Here, in order to determine a reference picture (hereinafter, called “areference picture for a temporal merge candidate”) used in performingmotion compensation using the temporal merge candidate or a referencepicture required for scaling the motion vector, there are methods 1) amethod of selecting N-th reference picture of a reference picture list,2) a method of selecting a reference picture most often selected fromencoded/decoded spatial/temporal candidate blocks as a referencepicture, 3) a method of selecting a reference picture of a mergecandidate where RD cost function is minimized from spatial/temporalmerge candidates of the current block, 4) a method of selecting areference picture where RD cost function is minimized after performingmotion prediction of the current block.

1) A Method of Selecting N-Th Reference Picture of a Reference PictureList

The N-th reference picture of the reference picture list of the currentblock may be determined as a reference picture for the temporal mergecandidate of the current block or a reference picture required forscaling the motion vector.

In this case, N is a positive integer larger than zero, and may besignaled from the encoder to the decoder, or may be a fixed value presetin the encoder/decoder. Also, N may be derived from N of thetemporal/spatial neighbor block. The maximum value of N may mean themaximum number of reference pictures included in the reference picturelist.

For example, when N=1, based on a coding parameter obtained from atleast one of the current block, the sub-block of the current block, andthe encoded/decoded spatial/temporal blocks, motion information derivedfrom the co-located block (or a sub-block of the co-located block) maybe scaled according to the first reference picture of the referencepicture list of the current block. Here, the coding parameter mayinclude at least one of a motion vector, a reference picture index, aninter prediction indicator, and a picture order count.

2) A Method of Selecting a Reference Picture Most Often Selected fromEncoded/Decoded Spatial/Temporal Candidate Blocks as a Reference Picture

A reference picture most often selected from the encoded/decodedspatial/temporal candidate blocks as a reference picture may bedetermined as a reference picture for the temporal merge candidate ofthe current block or as a reference picture required for scaling themotion vector.

For example, based on a coding parameter obtained from at least one ofthe current block, the sub-block of the current block, andencoded/decoded spatial/temporal blocks, motion information derived fromthe co-located block (or a sub-block of the co-located block) may bescaled according to the reference picture most often selected fromencoded/decoded spatial/temporal candidate blocks as a referencepicture.

3) A Method of Selecting a Reference Picture of a Merge Candidate whereRD Cost Function is Minimized from Spatial/Temporal Merge Candidates ofthe Current Block

The reference picture of the merge candidate where RD cost function isminimized from spatial/temporal merge candidates of the current blockmay be determined as a reference picture for the temporal mergecandidate of the current block or a reference picture required forscaling the motion vector.

In this case, index information of the merge candidate where RD costfunction is minimized from spatial/temporal merge candidates of thecurrent block may be signaled from the encoder to the decoder, or may bea fixed value preset in the encoder/decoder. Also, index information maybe derived from index information of the temporal/spatial neighborblock.

For example, based on a coding parameter obtained from at least one ofthe current block, the sub-block of the current block, andencoded/decoded spatial/temporal blocks, motion information derived fromthe co-located block (or a sub-block of the co-located block) may bescaled according to reference picture of the merge candidate where RDcost function is minimized from spatial/temporal merge candidates of thecurrent block.

4) A Method of Selecting a Reference Picture where RD Cost Function isMinimized after Performing Motion Prediction of the Current Block

The reference picture where RD cost function is minimized afterperforming motion prediction of the current block may be determined as areference picture for the temporal merge candidate of the current blockor a reference picture required for scaling the motion vector.

In this case, index information for the reference picture where RD costfunction is minimized after performing motion prediction of the currentblock may be signaled from the encoder to the decoder, or may be a fixedvalue preset in the encoder/decoder. Also, the index information may bederived from index information of the temporal/spatial neighbor block.

For example, based on a coding parameter obtained from at least one ofthe current block, the sub-block of the current block, andencoded/decoded spatial/temporal blocks, the motion information derivedfrom the co-located block (or a sub-block of the co-located block) maybe scaled according to a reference picture where RD cost function isminimized after performing motion prediction of the current block.

When a distance (difference value of POC) between a picture (currentpicture) including a current block (or a sub-block of the current block)and a reference picture of the current block (or a sub-block of thecurrent block) is different from a distance (difference value of POC)between a co-located picture and a reference picture of the co-locatedblock (or a sub-block of the co-located block) but for each referencepicture list, at least one reference picture of the current block (or asub-block of the current block) is the same as at least one referencepicture of the co-located block (or a sub-block of the co-locatedblock), a reference picture for the temporal merge candidate of thecurrent block may be adaptively selected. Here, according to theselected reference picture, the motion vector derived from theco-located block (or a sub-block of the co-located block) may be scaledand used as the temporal merge candidate.

FIGS. 12 and 13 are views showing examples of a method of adaptivelyselecting a reference picture for a temporal merge candidate and amethod of generating a prediction block by using a temporal mergecandidate according to the present invention.

In FIGS. 12 and 13, assuming random access encoding/decoding environment(random access configuration) at 16 of GOP (Group of picture) size, arandom square box may indicate one picture, and the number in the boxmay indicate a picture order count (POC) of a picture. When interprediction indicators of respective pictures are L0 and L1, referencepictures may be constructed according to respective inter predictionindicators. In the encoding/decoding environment of FIGS. 12 and 13,encoding/decoding may be performed according to 0, 16, 8, 4, 2, 1, 3, 6,5, 7, 12, 10, 9, 11, 14, 13, 15, 32, 24, 20, 18, 17, 19, 22, 21, 23, 28,26, 25, 27, 30, 29, and 31 based on POC.

In FIG. 12, when POC of a current picture/slice being encoded/decoded is20, in POC 20, reference pictures for POC 16 and POC 8 are constructedfor L0 direction, and reference pictures for POC 24 and POC 32 areconstructed for L1 direction. In this case, that may be indicated as“L0: 16, 8” and “L1: 24, 32”. Here, POC 16 may indicate the firstreference picture in L0 reference picture list, POC 8 may indicate thesecond reference picture in L0 reference picture list, POC 24 mayindicate the first reference picture in L1 reference picture list, andPOC 32 may indicate the second reference picture in L1 reference picturelist.

In FIG. 13, when POC of a current picture/slice being encoded/decoded is22, in POC 22, reference pictures for POC 20 and POC 16 may beconstructed for L0 direction, and reference pictures for POC 24 and POC32 may be constructed for L1 direction. In this case, that may beindicated as “L0: 20, 16” and “L1: 24, 32”. Here, POC 20 may indicatethe first reference picture in L0 reference picture list, POC 16 mayindicate the second reference picture in L0 reference picture list, POC24 may indicate the first reference picture in L1 reference picturelist, and POC 32 may indicate the second reference picture in L1reference picture list.

When LX reference picture list of a picture (current picture) includingthe current block

co-located block is the same as LX reference picture list of theco-located picture, a reference picture of LX direction for the temporalmerge candidate of the current block may be selected as one of 1) areference picture used by a motion vector of LX direction derived fromthe co-located block, 2) a reference picture not used by a motion vectorof LX direction derived from the co-located block. Here, X is an integerincluding zero, and LX may be expressed as L0, L1, L2, etc.

As shown in FIG. 12, assuming that the current picture is POC 20 and theco-located picture is POC 24, when the current picture POC 20 and theco-located picture POC 24 has the same reference picture list (L0: 16,8) for L0 direction, a reference picture of LO direction for thetemporal merge candidate of the current block may be selected as oneof 1) a reference picture used by a motion vector of L0 directionderived from the co-located block, 2) a reference picture not used by amotion vector of L0 direction derived from the co-located block.

For example, in FIG. 12, when the motion vector of L0 direction derivedfrom the co-located block uses POC 16 as L0 reference picture of theco-located block, POC 16 may be used as LO reference picture for thetemporal merge candidate of the current block, and the corresponding L0motion vector may be scaled according to the picture of POC 16.

As another example, in FIG. 12, when motion vector of L0 directionderived from the co-located block uses POC 16 as L0 reference picture ofthe co-located block, POC 8 may be used as LO reference picture for thetemporal merge candidate of the current block, and the corresponding L0motion vector may be scaled according to the picture of POC 8.

As shown in FIG. 13, assuming that the current picture is POC 22 and theco-located picture is POC 20, when the current picture POC 22 and theco-located picture POC 20 have the same reference picture list (L1: 24,32) for L1 direction, the reference picture of L1 direction for thetemporal merge candidate of the current block may be selected as oneof 1) a reference picture used by a motion vector of L1 directionderived from the co-located block, 2) a reference picture not used by amotion vector of L1 direction derived from the co-located block.

For example, in FIG. 13, when the motion vector of L1 direction derivedfrom the co-located block uses POC 24 as L1 reference picture of theco-located block, POC 24 may be used as L1 reference picture for thetemporal merge candidate of the current block, and the corresponding L0motion vector may be scaled according to the picture of POC 24.

As another example, in FIG. 13, when the motion vector of L1 directionderived from the co-located block uses POC 24 as L1 reference picture ofthe co-located block, POC 32 may be used as L1 reference picture for thetemporal merge candidate of the current block, and the corresponding L1motion vector may be scaled according to the picture of POC 32.

In contrast, when LX reference picture list of a picture (currentpicture) including the current block is different from LX referencepicture list of the co-located picture including the co-located blockand only some reference pictures are the same, a reference picture of LXdirection for the temporal merge candidate of the current block may beselected as a reference picture used by a motion vector of LX directionderived from the co-located block among the same reference pictures.

Here, when the reference picture used by the motion vector of LXdirection derived from the co-located block is not included in the LXreference picture list of the current picture, the reference picture ofLX direction for the temporal merge candidate of the current block maybe selected as a reference picture closest to the current picture fromLX reference picture of the current block.

In the environment of FIG. 12, when the motion vector of L1 directionderived from the co-located block uses POC 32 as L1 reference picture ofthe co-located block, POC 32 may be used as L1 reference picture for thetemporal merge candidate of the current block, and the corresponding L1motion vector may be scaled according to the picture of POC 32.

In contrast, in the environment of FIG. 12, when the motion vector of L1direction derived from the co-located block uses POC 16 as L1 referencepicture of the co-located block, POC 24 may be used as L1 referencepicture for the temporal merge candidate of the current block, and thecorresponding L1 motion vector may be scaled according to the selectedreference picture.

In the environment of FIG. 13, when the motion vector of L0 directionderived from the co-located block uses POC 16 as L0 reference picture ofthe co-located block, POC 16 may be used as L0 reference picture for thetemporal merge candidate of the current block, and the corresponding L0motion vector may be scaled according to the picture of POC 16.

In contrast, in the environment of FIG. 13, when the motion vector of L0direction derived from the co-located block uses POC 8 as L0 referencepicture of the co-located block, POC 20 may be used as L0 referencepicture for the temporal merge candidate of the current block, and thecorresponding L0 motion vector may be scaled according to the selectedreference picture.

In the meantime, in generating an inter prediction block of LX directionby using the temporal merge candidate, LX motion vector derived from theco-located block is scaled based on a reference picture of LX referencepicture list of the current block, and the inter prediction block may begenerated by using at least one scaled LX motion vector. Here, at leastone scaled LX motion vector based on a reference picture of LX referencepicture list of the current block may be derived as much as the numberof LX reference picture of LX reference picture list of the currentblock.

Accordingly, when there is a plurality of LX reference pictures of LXreference picture list of the current block, a plurality of scaled LXmotion vectors may be derived.

As described above, when a plurality of scaled LX motion vectors arederived, LX motion vector of one temporal merge candidate may be derivedby using one of a median value, an average value, a minimum value, amaximum value, a weighted average value, and a mode between a pluralityof scaled LX motion vectors.

Alternatively, when a plurality of scaled LX motion vectors are derived,a plurality of prediction blocks may be generated by using a pluralityof scaled LX motion vectors corresponding to different LX referencepictures, and a prediction block of one current block may be derived byusing one of a median value, an average value, a minimum value, amaximum value, a weighted average value, and a mode between thegenerated plurality of prediction blocks. Here, the weighted averagevalue may be calculated in proportion to a POC difference value betweenthe current picture and the reference picture.

For example, in the environment of FIG. 12, when the motion vector of L0direction derived from the co-located block uses POC 16 as L0 referencepicture of the co-located block, two scaled L0 motion vectors may bederived based on reference pictures (POC 16 and POC 8) of L0 referencepicture list of the current block, and the inter prediction block of L0direction using the temporal merge candidate may be generated based onthe two derived L0 motion vectors.

Here, L0 motion vector of one temporal merge candidate may be derived byusing an average value between two derived L0 motion vectors, and L0motion vector of one temporal merge candidate may be applied to one ofL0 reference pictures (POC 16 and POC 8) of the current block such thatthe prediction block may be generated. Here, L0 reference picture of thecurrent block being applied to generate the prediction block may bedetermined by using the above-described method (for example, L0reference picture of the temporal merge candidate may be determined asL0 reference picture used by L0 motion vector derived from theco-located block).

Alternatively, two prediction blocks may be generated by using two L0motion vectors corresponding to different L0 reference pictures (POC 16and POC 8), and a prediction block of one current block may be derivedby using a weighted average value (or a weighted sum) between the twoprediction blocks. Specifically, in FIG. 12, with respect to the currentpicture (POC 20), a reference picture of POC 16 and a reference pictureof POC 8 respectively have POC difference of 4 and 12. Thus, a weightedsum to which a proportion of 3:1 is applied is calculated for aprediction block corresponding to the reference picture of POC 16 and aprediction block corresponding to the reference picture of POC 8,thereby generating the prediction block.

A method of generating an inter prediction block of L1 direction using atemporal merge candidate in FIG. 13 may be performed in the same manneras a method of generating an inter prediction block of L0 direction inFIG. 12.

As another example, in FIG. 12, when the motion vector of L1 directionderived from the co-located block uses POC 32 as L1 reference picture ofthe co-located block, two scaled L1 motion vectors may be derived basedon reference pictures (POC 24 and POC 32) of L1 reference picture listof the current block, and the inter prediction block of L0 directionusing the temporal merge candidate may be generated based on the twoderived L1 motion vectors.

Here, L1 motion vector of one temporal merge candidate may be derived byusing an average value between the two derived L1 motion vectors, and L1motion vector of one temporal merge candidate may be applied to one ofL1 reference pictures (POC 24 and POC 32) of the current block togenerate a prediction block. Here, L1 reference picture of the currentblock being applied to generate the prediction block may be determinedby using the above-described method.

Alternatively, two prediction blocks may be generated by using two L1motion vectors corresponding to different L1 reference pictures (POC 24and POC 32), and a prediction block of one current block may be derivedby using a weighted average value (or a weighted sum) between the twoprediction blocks. Specifically, in FIG. 12, with respect to the currentpicture (POC 20), a reference picture of POC 24 and a reference pictureof POC 32 respectively have POC difference of 4 and 12. Thus, a weightedsum to which a proportion of 3:1 is applied is calculated for aprediction block corresponding to the reference picture of POC 24 and aprediction block corresponding to the reference picture of POC 32,thereby generating the prediction block.

A method of generating an inter prediction block of L0 direction usingthe temporal merge candidate in FIG. 13 may be performed in the samemanner as a method of generating an inter prediction block of L1direction in FIG. 12.

FIGS. 14 and 15 are views showing examples of a method of adaptivelyselecting a reference picture for a temporal merge candidate in a lowdelay encoding/decoding environment (low delay configuration). In FIG.14, it is assumed a uni-directional prediction encoding/decodingenvironment where only L0 reference picture list is used, and in FIG.15, it is assumed a bi-directional prediction encoding/decodingenvironment where L0 reference picture list and L1 reference picturelist are used.

Like the above-described random access encoding/decoding environment, ina low delay encoding/decoding environment, when LX reference picturelist of a picture (current picture) including the current block isdifferent from LX reference picture list of the co-located pictureincluding the co-located block and only some reference pictures are thesame, a reference picture of LX direction for the temporal mergecandidate of the current block may be selected as a reference pictureused by a motion vector of LX direction derived from the co-locatedblock among the same reference pictures. That is, when a referencepicture used by a motion vector of LX direction derived from theco-located block is included in LX reference picture list of the currentpicture, the reference picture may be selected as a reference picturefor the temporal merge candidate of the current block.

In contrast, when a reference picture used by the motion vector of LXdirection derived from the co-located block is not included in LXreference picture list of the current picture, a reference picture of LXdirection for the temporal merge candidate of the current block may beselected as a reference picture closest to the current picture from LXreference picture of the current block.

For example, in the environment of FIG. 14, when a motion vector of L0direction derived from the co-located block uses POC 8 as L0 referencepicture of the co-located block, POC 8 may be used as L0 referencepicture for the temporal merge candidate of the current block, and thecorresponding L0 motion vector may be scaled according to the picture ofPOC 8.

In contrast, in the environment of FIG. 14, when a motion vector of L0direction derived from the co-located block uses POC 9 as L0 referencepicture of the co-located block, POC 11 may be used as L0 referencepicture for the temporal merge candidate of the current block, and thecorresponding L0 motion vector may be scaled according to the selectedreference picture.

A method of generating inter prediction block of L0 and L1 directionsusing an temporal merge candidate in FIG. 15 may be performed in thesame manner as a method of generating an inter prediction block of L0direction in FIG. 14.

Hereinbelow, a method of partitioning a current block into sub-blocksand deriving a temporal merge candidate for each sub-block will bedescribed.

A temporal merge candidate for the sub-block of the current block may bederived from motion information of the sub-block of the co-located block(called “co-located sub-block”). Here, the co-located sub-block is asub-block at a particular position in the co-located block, may be asub-block at a fixed position preset in the encoder/decoder (forexample, a center block, a corner block). Alternatively, the co-locatedsub-block may be differently determined in the position of the sub-blockof a current encoding/decoding target (called “current sub-block”). Forexample, the co-located sub-block may be a sub-block at the sameposition as the current sub-block, or may be a sub-block correspondingto the position adjacent to the current sub-block. The co-locatedsub-block may be a sub-block divided in the same size as the currentsub-block in the co-located block.

In the meantime, when motion information of the co-located sub-block isunavailable (for example, when the intra encoded or when the use of theco-located sub-block is restricted in deriving motion information of thecurrent sub-block), the temporal merge candidate for the sub-block ofthe current block may be derived in the following methods.

1) By using motion information of the spatial candidate blocks of theencoded/decoded current block, the temporal merge candidate for thesub-block of the current block may be derived. Here, the first spatialcandidate block may be selected according to a spatial merge candidatesearch order, or the spatial candidate block may be selected based on apredetermined priority.

Alternatively, by using one of a median value, an average value, aminimum value, a maximum value, a weighted average value, and a mode ofmotion information of a plurality spatial candidate blocks of thecurrent block, the temporal merge candidate for the sub-block of thecurrent block may be derived.

2) By using motion information of spatial candidate blocks of theco-located block, the temporal merge candidate for the sub-block of thecurrent block may be derived. Here, the first spatial candidate blockmay be selected according to the spatial merge candidate search order,or the spatial candidate block may be selected based on thepredetermined priority.

Alternatively, by using one of a median value, an average value, aminimum value, a maximum value, a weighted average value, and a mode ofmotion information of a plurality of spatial candidate blocks of theco-located block, the temporal merge candidate for the sub-block of thecurrent block may be derived.

3) The temporal merge candidate of the current sub-block may be derivedby using motion information having a predetermined fixed value. Forexample, zero motion vector having a size of zero for horizontal andvertical directions may be used as the temporal merge candidate of thecurrent sub-block.

4) By using motion information of another co-located sub-block (left,top, right, bottom, diagonal, center), the temporal merge candidate ofthe current sub-block may be derived.

For example, as shown in FIG. 16, when motion information of the currentco-located sub-block is unavailable, motion information of the sub-blockof the center position in the co-located block may be derived as thetemporal merge candidate of the current sub-block.

As another example, as shown in FIG. 17, when motion information of thecurrent co-located sub-block is unavailable, the temporal mergecandidate of the current sub-block may be derived by using motioninformation of the bottom left block of the current co-located sub-blockin the co-located block and/or the top sub-block of the currentco-located sub-block.

FIG. 18 is a view showing an example of performing motion compensationon each sub-block.

Referring to FIG. 18, the current block may be partitioned into foursub-blocks (A, B, C, D), and motion compensation may be performed foreach sub-block by using at least one of motion information of thespatial candidate block (or a sub-block of the spatial candidate block)and the co-located block (or a sub-block of the co-located block). Here,the motion information may include at least one of a motion vector, aninter prediction indicator, a reference picture index, a picture ordercount.

A process of performing motion compensation a sub-block A of the currentblock will be described in detail.

1) Obtaining Motion Information of a Spatial Candidate Block and/orCo-Located Block

First, a plurality of pieces of motion information may be obtained byscanning the spatial candidate block of the sub-block A of the currentblock according to a predetermined order. Here, the predetermined ordermay be a predefined order in the encoder/decoder, or may be an orderdefined by information being signaled from the encoder to the decoder.

For example, motion information may be obtained by performing scanningfrom the left to the right based on the top sub-block a of the sub-blockA. When the top sub-block a is unavailable, motion information may beobtained by scanning the top sub-block b. That is, scanning may beperformed until the top sub-block having available motion information isfound.

After obtaining motion information from the top sub-block, the motioninformation may be obtained by performing scanning from the top to thebottom based on the sub-block c on the left of the sub-block A. When theleft sub-block c is unavailable, motion information may be obtained byscanning the left sub-block d.

After obtaining motion information from the top sub-block and/or theleft sub-block, motion information may be obtained from the co-locatedblock of the sub-block A. Here, the co-located block of the sub-block Amay be the co-located block of the current block including the sub-blockA, or may be the sub-block of the co-located block directlycorresponding to the sub-block A. The sub-block of the co-located blockdirectly corresponding to the sub-block A may be selected as describedabove. Alternatively, motion information may be obtained from theco-located block (or a sub-block of the co-located block) at theposition compensated by the motion vector of the spatial candidate blockof the current block.

In the same way, at most three pieces of motion information may beobtained from the top sub-block, the left sub-block, and the co-locatedblock. According to the embodiment, at most N pieces of motioninformation may be obtained. Here, N is a positive integer equal to orgreater than two.

2-1) Selecting of a Reference Picture for Motion Compensation andGenerating of a Motion Vector of a Sub-Block

When at least one of a) the first reference picture of the referencepicture list, b) the reference picture in a case where among obtainedthree pieces of motion information, motion vectors obtained from thespatial neighbor sub-block have the same reference picture, and c) amongobtained three pieces of motion information, the reference picture ofmotion vectors obtained from the spatial neighbor sub-block, is the sameas the reference picture of the motion vector the obtained from theco-located block, the reference picture for motion compensation of thesub-block A may be selected as the reference picture.

Next, at most three motion vectors are individually scaled based on theselected reference picture, and the motion vector of the sub-block A maybe generated by using one of a median value, an average value, a minimumvalue, a maximum value, a weighted average value, and a mode of at mostthree scaled motion vectors.

The motion vector of the sub-block A generates as above and the selectedreference picture are used to generate a prediction block of thesub-block A.

2-2) Generating a Plurality of Prediction Blocks and the FinalPrediction Block

After obtaining at most three pieces of motion information from the topsub-block, the left sub-block, and the co-located block, at most threeprediction blocks may be obtained through motion compensation fromrespective motion vectors of the obtained motion information and thereference picture corresponding thereto, and the prediction block forthe sub-block A may be generated based on a weighted sum thereof.

Here, the motion vector of the co-located block of the sub-block A maybe scaled based on the reference picture selected at 2-1). In this case,the prediction block may be obtained through motion compensation basedon the scaled motion vector and the selected reference picture.

FIG. 19 is a flowchart showing a method for decoding a video accordingto an embodiment of the present invention.

Referring to FIG. 19, a spatial merge candidate may be derived from atleast one of spatial candidate blocks of a current block at step S190.

Also, a temporal merge candidate may be derived from a co-located blockof the current block at step S1902.

Here, the deriving of the spatial candidate block and the temporal mergecandidate has been described in detail with reference to FIGS. 9 to 11,and thus description thereof will be omitted.

Also, a prediction block of the current block may be generated based onat least one of the derived spatial merge candidate and the derivedtemporal merge candidate at step S1903.

In this case, a reference picture for the temporal merge candidate maybe selected based on a reference picture list of a current pictureincluding the current block and a reference picture list of a co-locatedpicture including the co-located block. Here, the reference picture forthe temporal merge candidate may be a reference picture used inperforming motion compensation using the temporal merge candidate or areference picture used in scaling a motion vector of the co-locatedblock.

In the meantime, the reference picture for the temporal merge candidatemay be selected based on whether the reference picture list of thecurrent picture and the reference picture list of the co-located pictureare equal to each other.

For example, when the reference picture list of the current picture andthe reference picture list of the co-located picture are equal to eachother, the reference picture for the temporal merge candidate may beselected as a reference picture being used by a motion vector derivedfrom the co-located block.

As another example, when at least one reference picture of the referencepicture list of the current picture is the same as at least onereference picture of the reference picture list of the co-locatedpicture, the reference picture for the temporal merge candidate may beselected from the same at least one reference picture.

In the meantime, the reference picture for the temporal merge candidatemay be selected according to an inter prediction direction. Here, theinter prediction direction may be L0, L1, . . . , LX (X is a positiveinteger).

In the meantime, the spatial merge candidate and the temporal mergecandidate of the current block may be derived for each sub-block of thecurrent block.

In this case, the temporal merge candidate of the sub-block of thecurrent block may be derived from a sub-block at the same position as asub-block of the current block included in the co-located block.

However, when the sub-block at the same position is unavailable, thetemporal merge candidate of the sub-block of the current block may bederived from one of a sub-block of the center position in the co-locatedblock, a left sub-block of the sub-block at the same position, and a topsub-block of the sub-block at the same position.

In the meantime, the deriving of the temporal merge candidate at stepS1902 may include: scaling a plurality of motion vectors of theco-located block based on respective reference pictures of a referencepicture list of the current block, and deriving the temporal mergecandidate including the scaled plurality of motion vectors.

For example, the prediction block of the current block may be generatedby using a motion vector generated based on a weighted sum of the scaledplurality of motion vectors.

As another example, a plurality of temporary prediction blocks aregenerated by respectively using the scaled plurality of motion vectors,and the prediction block of the current block may be generated based ona weighted sum of the generated plurality of temporary predictionblocks.

In the meantime, the deriving of the temporal merge candidate at stepS1902 may be performed by scaling motion information of the co-locatedblock based on the reference picture for the temporal merge candidate.

In this case, the deriving of the temporal merge candidate by scalingthe motion information of the co-located block may be selectivelyperformed based on a picture order count value between the currentpicture including the current block and a reference picture of thecurrent block and a picture order count value between the co-locatedpicture including the co-located block and a reference picture of theco-located block.

For each of the luma and chroma signal, intra encoding/decoding can beperformed. For example, at least one of the derivation of intraprediction mode, block partitioning, construction of reference sampleand intra prediction may be applied to the luma signal and the chormasignal differently in the intra decoding process.

The intra encoding/decoding may be performed in the same manner for theluma and chroma signal. For example, at least one of the derivation ofintra prediction mode, block partitioning, construction of referencesample and intra prediction may be applied to the luma signal and thechorma signal equally in the intra decoding process.

The above methods can be performed by the same method in the encoder andthe decoder. For example, at least one of at least one of the derivationof intra prediction mode, block partitioning, construction of referencesample and intra prediction may be applied to the encoder and thedecoder in the intra decoding/decoding process. Also, the order ofapplying the methods may be different in the encoder and the decoder.For example, in performing intra encoding/decoding on the current block,the encoder may construct a reference sample and then perform one ormore intra prediction to encode the intra prediction mode determined.

The above embodiment of the present invention may be applied dependingon a size of at least one of a coding block, a prediction block, atransform block, a block, a current block, a coding unit, a predictionunit, a transform unit, a unit, and a current unit. Herein, the size maybe defined as a minimum size or maximum size or both so that the aboveembodiments are applied, or may be defined as a fixed size to which theabove embodiment is applied. In addition, in the above embodiments, afirst embodiment may be applied to a first size, and a second embodimentmay be applied to a second size. In other words, the above embodimentsmay be applied in combination depending on a size. In addition, theabove embodiments may be applied when a size is equal to or greater thata minimum size and equal to or smaller than a maximum size. In otherwords, the above embodiments may be applied when a block size isincluded within a certain range.

For example, the above embodiments may be applied when a size of currentblock is 8×8 or greater. For example, the above embodiments may beapplied when a size of current block is 4×4 or greater. For example, theabove embodiments may be applied when a size of current block is 16×16or greater. For example, the above embodiments may be applied when asize of current block is equal to or greater than 16×16 and equal to orsmaller than 64×64.

The above embodiments of the present invention may be applied dependingon a temporal layer. In order to identify a temporal layer to which theabove embodiments may be applied may be signaled, and the aboveembodiments may be applied to a specified temporal layer identified bythe corresponding identifier. Herein, the identifier may be defined asthe lowest layer or the highest layer or both to which the aboveembodiment may be applied, or may be defined to indicate a specificlayer to which the embodiment is applied. In addition, a fixed temporallayer to which the embodiment is applied may be defined.

For example, the above embodiments may be applied when a temporal layerof a current image is the lowest layer. For example, the aboveembodiments may be applied when a temporal layer identifier of a currentimage is 1. For example, the above embodiments may be applied when atemporal layer of a current image is the highest layer.

The reference picture set used in the reference picture listconstruction and the reference picture list modification process, as inthe embodiment of the present invention, is L0, L1, L2, L3 At least onereference video list can be used.

According to the embodiment of the present invention, at least onemotion vector of the current block to be encoded/decoded and a maximumof N motion vectors may be used in calculating the boundary strength inthe deblocking filter. Here, N represents a positive integer of 1 ormore, and may be 2, 3, 4, and so on.

n motion vector prediction, a motion vector is divided into a 16-pelunit, an 8-pel unit, a 4-pel unit, an integer-pel unit, (½-pel), ¼-pel,⅛-pel, ( 1/32-pel), and 1/64-pixel ( 1/64-pel) units, the aboveembodiments of the present invention can be applied. In addition, whenmotion vector prediction is performed, a motion vector can beselectively used for each pixel unit.

A slice type to which the above embodiments of the present invention areapplied may be defined, and the above embodiments may be applieddepending on the corresponding slice type.

The slice type to which the embodiments of the present invention areapplied is defined and the embodiments of the present invention can beapplied according to the slice type. For example, when the slice type isT (Tri-predictive)-slice, a prediction block is generated using at leastthree motion vectors, and a weighted sum of at least three predictionblocks is calculated. For example, when the slice type is Q(Quad-Predictive)-slice, a prediction block is generated using at leastfour motion vectors, and a weighted sum of at least four predictionblocks is calculated.

The embodiments of the present invention can be applied not only to theinter prediction and motion compensation method using motion vectorprediction but also to inter prediction and motion compensation usingskip mode and merge mode.

A block form to which the above embodiments of the present invention areapplied may have a square form or a non-square form.

In the above-described embodiments, the methods are described based onthe flowcharts with a series of steps or units, but the presentinvention is not limited to the order of the steps, and rather, somesteps may be performed simultaneously or in different order with othersteps. In addition, it should be appreciated by one of ordinary skill inthe art that the steps in the flowcharts do not exclude each other andthat other steps may be added to the flowcharts or some of the steps maybe deleted from the flowcharts without influencing the scope of thepresent invention.

The embodiments include various aspects of examples. All possiblecombinations for various aspects may not be described, but those skilledin the art will be able to recognize different combinations.Accordingly, the present invention may include all replacements,modifications, and changes within the scope of the claims.

The embodiments of the present invention may be implemented in a form ofprogram instructions, which are executable by various computercomponents, and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include stand-alone or acombination of program instructions, data files, data structures, etc.The program instructions recorded in the computer-readable recordingmedium may be specially designed and constructed for the presentinvention, or well-known to a person of ordinary skilled in computersoftware technology field. Examples of the computer-readable recordingmedium include magnetic recording media such as hard disks, floppydisks, and magnetic tapes; optical data storage media such as CD-ROMs orDVD-ROMs; magneto-optimum media such as floptical disks; and hardwaredevices, such as read-only memory (ROM), random-access memory (RAM),flash memory, etc., which are particularly structured to store andimplement the program instruction. Examples of the program instructionsinclude not only a mechanical language code formatted by a compiler butalso a high level language code that may be implemented by a computerusing an interpreter. The hardware devices may be configured to beoperated by one or more software modules or vice versa to conduct theprocesses according to the present invention.

Although the present invention has been described in terms of specificitems such as detailed elements as well as the limited embodiments andthe drawings, they are only provided to help more general understandingof the invention, and the present invention is not limited to the aboveembodiments. It will be appreciated by those skilled in the art to whichthe present invention pertains that various modifications and changesmay be made from the above description.

Therefore, the spirit of the present invention shall not be limited tothe above-described embodiments, and the entire scope of the appendedclaims and their equivalents will fall within the scope and spirit ofthe invention.

INDUSTRIAL APPLICABILITY

The present invention may be used in an apparatus for encoding/decodinga video.

The invention claimed is:
 1. A method for decoding a video, the methodcomprising: obtaining a plurality of sub-blocks by dividing a currentblock into sub-block units; deriving motion information of each of theplurality of the sub-blocks by using motion information of co-locatedsub-blocks corresponding to each of the plurality of the sub-blocks; andgenerating a sub-block-based temporal merge candidate of the currentblock by using the derived motion information of the plurality of thesub-blocks, wherein when there is a co-located sub-block for whichmotion information is not available, motion information of a sub-blockcorresponding to the co-located sub-block for which the motioninformation is not available is determined as motion information of acenter block of the co-located block of the current block, wherein theco-located sub-blocks and the co-located block are present in aco-located picture of the current block, and wherein a position of theco-located sub-block and co-located block are determined by a motionvector of a neighboring block of the current block.
 2. The method ofclaim 1, wherein the neighboring block of the current block is aneighboring block which is a first order in the spatial merge candidatesearch order.
 3. The method of claim 1, wherein the neighboring block ofthe current block is a block adjacent to the left side of the currentblock.
 4. A method for encoding a video, the method comprising:obtaining a plurality of sub-blocks by dividing a current block intosub-block units; deriving motion information of each of the plurality ofthe sub-blocks by using motion information of co-located sub-blockscorresponding to each of the plurality of the sub-blocks; and generatingsub-block-based temporal merge candidate of the current block by usingthe derived motion information of the plurality of the sub-blocks,wherein when there is a co-located sub-block for which motioninformation is not available, motion information of a sub-blockcorresponding to the co-located sub-block for which the motioninformation is not available is determined as motion information of acenter block of the co-located block of the current block, wherein theco-located sub-blocks and the co-located block are present in aco-located picture of the current block, and wherein a position of theco-located sub-bock and co-located block are determined by a motionvector of a neighboring block of the current block.
 5. The method ofclaim 4, wherein the neighboring block of the current block is aneighboring block which is a first order in the spatial merge candidatesearch order.
 6. The method of claim 4, wherein the neighboring block ofthe current block is a block adjacent to the left side of the currentblock.
 7. A non-transitory computer readable recording medium storing abitstream generated by an image encoding method, wherein the videoencoding method comprises: obtaining a plurality of sub-blocks bydividing a current block into sub-block units; deriving motioninformation of each of the plurality of the sub-blocks by using motioninformation of co-located sub-blocks corresponding to each of theplurality of the sub-blocks; and generating sub-block-based temporalmerge candidate of the current block by using the derived motioninformation of the plurality of the sub-blocks, wherein when there is aco-located sub-block for which motion information is not available,motion information of a sub-block corresponding to the co-locatedsub-block for which the motion information is not available isdetermined as motion information of a center block of the co-locatedblock of the current block, wherein the co-located sub-blocks and theco-located block are present in a co-located picture of the currentblock, and wherein a position of the co-located sub-block and co-locatedblock are determined by a motion vector of a neighboring block of thecurrent block.